diff --git a/ide/codetoolsoptions.pas b/ide/codetoolsoptions.pas index d9d7468978..316716a4ce 100644 --- a/ide/codetoolsoptions.pas +++ b/ide/codetoolsoptions.pas @@ -51,6 +51,7 @@ type private FClassHeaderComments: boolean; FFilename: string; + FIdentComplAddParameterBrackets: boolean; // General FSrcPath: string; @@ -186,6 +187,8 @@ type write FIdentComplAddAssignOperator; property IdentComplAutoStartAfterPoint: boolean read FIdentComplAutoStartAfterPoint write FIdentComplAutoStartAfterPoint; + property IdentComplAddParameterBrackets: boolean + read FIdentComplAddParameterBrackets write FIdentComplAddParameterBrackets; // indentation property IndentOnLineBreak: boolean read FIndentOnLineBreak @@ -413,6 +416,8 @@ begin 'CodeToolsOptions/IdentifierCompletion/AddAssignOperator',true); FIdentComplAutoStartAfterPoint:=XMLConfig.GetValue( 'CodeToolsOptions/IdentifierCompletion/AutoStartAfterPoint',true); + FIdentComplAddParameterBrackets:=XMLConfig.GetValue( + 'CodeToolsOptions/IdentifierCompletion/AutoAddParameterBrackets',true); // indentation FIndentOnLineBreak := @@ -530,6 +535,8 @@ begin FIdentComplAddAssignOperator,true); XMLConfig.SetDeleteValue('CodeToolsOptions/IdentifierCompletion/AutoStartAfterPoint', FIdentComplAutoStartAfterPoint,true); + XMLConfig.SetDeleteValue('CodeToolsOptions/IdentifierCompletion/AutoAddParameterBrackets', + FIdentComplAddParameterBrackets,true); // indentation XMLConfig.SetDeleteValue('CodeToolsOptions/Indentation/OnLineBreak/Enabled' @@ -624,6 +631,7 @@ begin FIdentComplAddSemicolon:=CodeToolsOpts.FIdentComplAddSemicolon; FIdentComplAddAssignOperator:=CodeToolsOpts.FIdentComplAddAssignOperator; FIdentComplAutoStartAfterPoint:=CodeToolsOpts.FIdentComplAutoStartAfterPoint; + FIdentComplAddParameterBrackets:=CodeToolsOpts.FIdentComplAddParameterBrackets; end else Clear; @@ -671,6 +679,7 @@ begin FIdentComplAddSemicolon:=true; FIdentComplAddAssignOperator:=true; FIdentComplAutoStartAfterPoint:=true; + FIdentComplAddParameterBrackets:=true; // indentation FIndentOnLineBreak:=true; @@ -733,6 +742,7 @@ begin and (FIdentComplAddSemicolon=CodeToolsOpts.FIdentComplAddSemicolon) and (FIdentComplAddAssignOperator=CodeToolsOpts.FIdentComplAddAssignOperator) and (FIdentComplAutoStartAfterPoint=CodeToolsOpts.FIdentComplAutoStartAfterPoint) + and (FIdentComplAddParameterBrackets=CodeToolsOpts.FIdentComplAddParameterBrackets) ; end; diff --git a/ide/frames/codetools_identifiercompletion_options.lfm b/ide/frames/codetools_identifiercompletion_options.lfm index 51918e6e8f..361f1f18ff 100644 --- a/ide/frames/codetools_identifiercompletion_options.lfm +++ b/ide/frames/codetools_identifiercompletion_options.lfm @@ -10,10 +10,11 @@ inherited CodetoolsIndentifierComplietionOptionsFrame: TCodetoolsIndentifierComp object ICAddSemicolonCheckBox: TCheckBox[0] AnchorSideLeft.Control = Owner AnchorSideTop.Control = Owner - Left = 0 + Left = 6 Height = 22 - Top = 0 + Top = 6 Width = 191 + BorderSpacing.Around = 6 Caption = 'ICAddSemicolonCheckBox' TabOrder = 0 end @@ -21,24 +22,36 @@ inherited CodetoolsIndentifierComplietionOptionsFrame: TCodetoolsIndentifierComp AnchorSideLeft.Control = Owner AnchorSideTop.Control = ICAddSemicolonCheckBox AnchorSideTop.Side = asrBottom - Left = 0 + Left = 6 Height = 22 - Top = 28 + Top = 34 Width = 223 - BorderSpacing.Top = 6 + BorderSpacing.Around = 6 Caption = 'ICAddAssignOperatorCheckBox' TabOrder = 1 end object ICAutoStartAfterPointCheckBox: TCheckBox[2] - AnchorSideLeft.Control = ICAddSemicolonCheckBox + AnchorSideLeft.Control = Owner AnchorSideTop.Control = ICAddAssignOperatorCheckBox AnchorSideTop.Side = asrBottom - Left = 0 + Left = 6 Height = 22 - Top = 56 + Top = 62 Width = 224 - BorderSpacing.Top = 6 + BorderSpacing.Around = 6 Caption = 'ICAutoStartAfterPointCheckBox' TabOrder = 2 end + object ICAutoAddParameterBrackets: TCheckBox[3] + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = ICAutoStartAfterPointCheckBox + AnchorSideTop.Side = asrBottom + Left = 6 + Height = 22 + Top = 90 + Width = 214 + BorderSpacing.Around = 6 + Caption = 'ICAutoAddParameterBrackets' + TabOrder = 3 + end end diff --git a/ide/frames/codetools_identifiercompletion_options.lrs b/ide/frames/codetools_identifiercompletion_options.lrs index 0232006192..3f7591ad72 100644 --- a/ide/frames/codetools_identifiercompletion_options.lrs +++ b/ide/frames/codetools_identifiercompletion_options.lrs @@ -6,15 +6,20 @@ LazarusResources.Add('TCodetoolsIndentifierComplietionOptionsFrame','FORMDATA',[ +#3','#1#11'ClientWidth'#3#144#1#8'TabOrder'#2#0#7'Visible'#8#10'DesignLeft'#3 +#139#2#9'DesignTop'#3#6#1#0#242#2#0#9'TCheckBox'#22'ICAddSemicolonCheckBox' +#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#5'Owner'#4 - +'Left'#2#0#6'Height'#2#22#3'Top'#2#0#5'Width'#3#191#0#7'Caption'#6#22'ICAddS' - +'emicolonCheckBox'#8'TabOrder'#2#0#0#0#242#2#1#9'TCheckBox'#27'ICAddAssignOp' - +'eratorCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Cont' - +'rol'#7#22'ICAddSemicolonCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'L' - +'eft'#2#0#6'Height'#2#22#3'Top'#2#28#5'Width'#3#223#0#17'BorderSpacing.Top'#2 - +#6#7'Caption'#6#27'ICAddAssignOperatorCheckBox'#8'TabOrder'#2#1#0#0#242#2#2#9 - +'TCheckBox'#29'ICAutoStartAfterPointCheckBox'#22'AnchorSideLeft.Control'#7#22 - +'ICAddSemicolonCheckBox'#21'AnchorSideTop.Control'#7#27'ICAddAssignOperatorC' - +'heckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#22#3 - +'Top'#2'8'#5'Width'#3#224#0#17'BorderSpacing.Top'#2#6#7'Caption'#6#29'ICAuto' - +'StartAfterPointCheckBox'#8'TabOrder'#2#2#0#0#0 + +'Left'#2#6#6'Height'#2#22#3'Top'#2#6#5'Width'#3#191#0#20'BorderSpacing.Aroun' + +'d'#2#6#7'Caption'#6#22'ICAddSemicolonCheckBox'#8'TabOrder'#2#0#0#0#242#2#1#9 + +'TCheckBox'#27'ICAddAssignOperatorCheckBox'#22'AnchorSideLeft.Control'#7#5'O' + +'wner'#21'AnchorSideTop.Control'#7#22'ICAddSemicolonCheckBox'#18'AnchorSideT' + +'op.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#22#3'Top'#2'"'#5'Width'#3 + +#223#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#27'ICAddAssignOperatorCheck' + +'Box'#8'TabOrder'#2#1#0#0#242#2#2#9'TCheckBox'#29'ICAutoStartAfterPointCheck' + +'Box'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#27'I' + +'CAddAssignOperatorCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2 + +#6#6'Height'#2#22#3'Top'#2'>'#5'Width'#3#224#0#20'BorderSpacing.Around'#2#6#7 + +'Caption'#6#29'ICAutoStartAfterPointCheckBox'#8'TabOrder'#2#2#0#0#242#2#3#9 + +'TCheckBox'#26'ICAutoAddParameterBrackets'#22'AnchorSideLeft.Control'#7#5'Ow' + +'ner'#21'AnchorSideTop.Control'#7#29'ICAutoStartAfterPointCheckBox'#18'Ancho' + +'rSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#22#3'Top'#2'Z'#5'Widt' + +'h'#3#214#0#20'BorderSpacing.Around'#2#6#7'Caption'#6#26'ICAutoAddParameterB' + +'rackets'#8'TabOrder'#2#3#0#0#0 ]); diff --git a/ide/frames/codetools_identifiercompletion_options.pas b/ide/frames/codetools_identifiercompletion_options.pas index 72472bdf57..e6f86861fd 100644 --- a/ide/frames/codetools_identifiercompletion_options.pas +++ b/ide/frames/codetools_identifiercompletion_options.pas @@ -33,6 +33,7 @@ type { TCodetoolsIndentifierComplietionOptionsFrame } TCodetoolsIndentifierComplietionOptionsFrame = class(TAbstractIDEOptionsEditor) + ICAutoAddParameterBrackets: TCheckBox; ICAutoStartAfterPointCheckBox: TCheckBox; ICAddAssignOperatorCheckBox: TCheckBox; ICAddSemicolonCheckBox: TCheckBox; @@ -61,6 +62,7 @@ begin ICAddSemicolonCheckBox.Caption:=dlgAddSemicolon; ICAddAssignOperatorCheckBox.Caption:=dlgAddAssignmentOperator; ICAutoStartAfterPointCheckBox.Caption:=lisAutomaticallyInvokeAfterPoint; + ICAutoAddParameterBrackets.Caption:=lisAddParameterBrackets; end; procedure TCodetoolsIndentifierComplietionOptionsFrame.ReadSettings( @@ -71,6 +73,7 @@ begin ICAddSemicolonCheckBox.Checked := IdentComplAddSemicolon; ICAddAssignOperatorCheckBox.Checked := IdentComplAddAssignOperator; ICAutoStartAfterPointCheckBox.Checked := IdentComplAutoStartAfterPoint; + ICAutoAddParameterBrackets.Checked:=IdentComplAddParameterBrackets; end; end; @@ -82,6 +85,7 @@ begin IdentComplAddSemicolon := ICAddSemicolonCheckBox.Checked; IdentComplAddAssignOperator := ICAddAssignOperatorCheckBox.Checked; IdentComplAutoStartAfterPoint := ICAutoStartAfterPointCheckBox.Checked; + IdentComplAddParameterBrackets:=ICAutoAddParameterBrackets.Checked; end; end; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 86cbc71064..da05b6b68e 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -4508,6 +4508,7 @@ resourcestring +'long description'; lisInsertPrintShortTag = 'Insert PrintShort tag'; lisAutomaticallyInvokeAfterPoint = 'Automatically invoke after point'; + lisAddParameterBrackets = 'Add parameter brackets'; lisShowEmptyUnitsPackages = 'Show empty units/packages'; lisUsePackageInProject = 'Use package %s in project'; lisUsePackageInPackage = 'Use package %s in package %s'; diff --git a/ide/sourceeditprocs.pas b/ide/sourceeditprocs.pas index 6604b72d29..07500bd9cd 100644 --- a/ide/sourceeditprocs.pas +++ b/ide/sourceeditprocs.pas @@ -517,6 +517,7 @@ begin icvProcWithParams: // add brackets for parameter lists if (AddChar='') + and CodeToolsOpts.IdentComplAddParameterBrackets and (ilcfStartInStatement in IdentList.ContextFlags) and (not IdentList.StartUpAtomBehindIs('(')) and (not IdentList.StartUpAtomInFrontIs('@')) then begin @@ -528,6 +529,7 @@ begin icvIndexedProp: // add brackets for parameter lists if (AddChar='') + and CodeToolsOpts.IdentComplAddParameterBrackets and (ilcfStartInStatement in IdentList.ContextFlags) and (not IdentList.StartUpAtomBehindIs('[')) then begin Result:=Result+'[]';