IDE, SourceEditor: implemented identifier-completion activates on typing. Issue #0033054 (different from patch)

git-svn-id: trunk@63314 -
This commit is contained in:
martin 2020-06-06 15:16:21 +00:00
parent dcc69156e5
commit f3f864d967
5 changed files with 292 additions and 72 deletions

View File

@ -66,6 +66,9 @@ type
FFilename: string; FFilename: string;
FIdentComplAddDo: Boolean; FIdentComplAddDo: Boolean;
FIdentComplAddParameterBrackets: boolean; FIdentComplAddParameterBrackets: boolean;
FIdentComplOnTypeMinLength: Integer;
FIdentComplOnTypeOnlyWordEnd: boolean;
FIdentComplOnTypeUseTimer: boolean;
FIdentComplReplaceIdentifier: boolean; FIdentComplReplaceIdentifier: boolean;
FIdentComplJumpToError: boolean; FIdentComplJumpToError: boolean;
FIdentComplShowHelp: boolean; FIdentComplShowHelp: boolean;
@ -121,6 +124,7 @@ type
// identifier completion // identifier completion
FIdentComplAddSemicolon: Boolean; FIdentComplAddSemicolon: Boolean;
FIdentComplAddAssignOperator: Boolean; FIdentComplAddAssignOperator: Boolean;
FIdentComplAutoInvokeOnType: boolean;
FIdentComplAutoStartAfterPoint: boolean; FIdentComplAutoStartAfterPoint: boolean;
FIdentComplAutoUseSingleIdent: boolean; FIdentComplAutoUseSingleIdent: boolean;
FIdentComplUseContainsFilter: Boolean; FIdentComplUseContainsFilter: Boolean;
@ -251,6 +255,14 @@ type
property IdentComplAddAssignOperator: Boolean read FIdentComplAddAssignOperator property IdentComplAddAssignOperator: Boolean read FIdentComplAddAssignOperator
write FIdentComplAddAssignOperator; write FIdentComplAddAssignOperator;
property IdentComplAddDo: Boolean read FIdentComplAddDo write FIdentComplAddDo; property IdentComplAddDo: Boolean read FIdentComplAddDo write FIdentComplAddDo;
property IdentComplAutoInvokeOnType: boolean read FIdentComplAutoInvokeOnType
write FIdentComplAutoInvokeOnType;
property IdentComplOnTypeUseTimer: boolean read FIdentComplOnTypeUseTimer
write FIdentComplOnTypeUseTimer;
property IdentComplOnTypeOnlyWordEnd: boolean read FIdentComplOnTypeOnlyWordEnd
write FIdentComplOnTypeOnlyWordEnd;
property IdentComplOnTypeMinLength: Integer read FIdentComplOnTypeMinLength
write FIdentComplOnTypeMinLength;
property IdentComplAutoStartAfterPoint: boolean read FIdentComplAutoStartAfterPoint property IdentComplAutoStartAfterPoint: boolean read FIdentComplAutoStartAfterPoint
write FIdentComplAutoStartAfterPoint; write FIdentComplAutoStartAfterPoint;
property IdentComplAutoUseSingleIdent: boolean read FIdentComplAutoUseSingleIdent property IdentComplAutoUseSingleIdent: boolean read FIdentComplAutoUseSingleIdent
@ -571,6 +583,14 @@ begin
'CodeToolsOptions/IdentifierCompletion/AddAssignOperator',true); 'CodeToolsOptions/IdentifierCompletion/AddAssignOperator',true);
FIdentComplAddDo:=XMLConfig.GetValue( FIdentComplAddDo:=XMLConfig.GetValue(
'CodeToolsOptions/IdentifierCompletion/AddDo',true); 'CodeToolsOptions/IdentifierCompletion/AddDo',true);
FIdentComplAutoInvokeOnType:=XMLConfig.GetValue(
'CodeToolsOptions/IdentifierCompletion/AutoInvokeOnType',False);
FIdentComplOnTypeUseTimer:=XMLConfig.GetValue(
'CodeToolsOptions/IdentifierCompletion/OnTypeUseTimer',true);
FIdentComplOnTypeOnlyWordEnd:=XMLConfig.GetValue(
'CodeToolsOptions/IdentifierCompletion/OnTypeOnlyWordEnd',true);
FIdentComplOnTypeMinLength:=XMLConfig.GetValue(
'CodeToolsOptions/IdentifierCompletion/OnTypeMinLength',2);
FIdentComplAutoStartAfterPoint:=XMLConfig.GetValue( FIdentComplAutoStartAfterPoint:=XMLConfig.GetValue(
'CodeToolsOptions/IdentifierCompletion/AutoStartAfterPoint',true); 'CodeToolsOptions/IdentifierCompletion/AutoStartAfterPoint',true);
FIdentComplAutoUseSingleIdent:=XMLConfig.GetValue( FIdentComplAutoUseSingleIdent:=XMLConfig.GetValue(
@ -748,6 +768,14 @@ begin
FIdentComplAddAssignOperator,true); FIdentComplAddAssignOperator,true);
XMLConfig.SetDeleteValue('CodeToolsOptions/IdentifierCompletion/AddDo', XMLConfig.SetDeleteValue('CodeToolsOptions/IdentifierCompletion/AddDo',
FIdentComplAddDo,true); FIdentComplAddDo,true);
XMLConfig.SetDeleteValue('CodeToolsOptions/IdentifierCompletion/AutoInvokeOnType',
FIdentComplAutoInvokeOnType,False);
XMLConfig.SetDeleteValue('CodeToolsOptions/IdentifierCompletion/OnTypeUseTimer',
FIdentComplOnTypeUseTimer,true);
XMLConfig.SetDeleteValue('CodeToolsOptions/IdentifierCompletion/OnTypeOnlyWordEnd',
FIdentComplOnTypeOnlyWordEnd,true);
XMLConfig.SetDeleteValue('CodeToolsOptions/IdentifierCompletion/OnTypeMinLength',
FIdentComplOnTypeMinLength,2);
XMLConfig.SetDeleteValue('CodeToolsOptions/IdentifierCompletion/AutoStartAfterPoint', XMLConfig.SetDeleteValue('CodeToolsOptions/IdentifierCompletion/AutoStartAfterPoint',
FIdentComplAutoStartAfterPoint,true); FIdentComplAutoStartAfterPoint,true);
XMLConfig.SetDeleteValue('CodeToolsOptions/IdentifierCompletion/AutoUseSingleIdent', XMLConfig.SetDeleteValue('CodeToolsOptions/IdentifierCompletion/AutoUseSingleIdent',
@ -907,6 +935,10 @@ begin
FIdentComplAddSemicolon:=CodeToolsOpts.FIdentComplAddSemicolon; FIdentComplAddSemicolon:=CodeToolsOpts.FIdentComplAddSemicolon;
FIdentComplAddAssignOperator:=CodeToolsOpts.FIdentComplAddAssignOperator; FIdentComplAddAssignOperator:=CodeToolsOpts.FIdentComplAddAssignOperator;
FIdentComplAddDo:=CodeToolsOpts.FIdentComplAddDo; FIdentComplAddDo:=CodeToolsOpts.FIdentComplAddDo;
FIdentComplAutoInvokeOnType:=CodeToolsOpts.FIdentComplAutoInvokeOnType;
FIdentComplOnTypeUseTimer:=CodeToolsOpts.FIdentComplOnTypeUseTimer;
FIdentComplOnTypeOnlyWordEnd:=CodeToolsOpts.FIdentComplOnTypeOnlyWordEnd;
FIdentComplOnTypeMinLength:=CodeToolsOpts.FIdentComplOnTypeMinLength;
FIdentComplAutoStartAfterPoint:=CodeToolsOpts.FIdentComplAutoStartAfterPoint; FIdentComplAutoStartAfterPoint:=CodeToolsOpts.FIdentComplAutoStartAfterPoint;
FIdentComplAutoUseSingleIdent:=CodeToolsOpts.FIdentComplAutoUseSingleIdent; FIdentComplAutoUseSingleIdent:=CodeToolsOpts.FIdentComplAutoUseSingleIdent;
FIdentComplUseContainsFilter:=CodeToolsOpts.FIdentComplUseContainsFilter; FIdentComplUseContainsFilter:=CodeToolsOpts.FIdentComplUseContainsFilter;
@ -975,6 +1007,10 @@ begin
FIdentComplAddSemicolon:=true; FIdentComplAddSemicolon:=true;
FIdentComplAddAssignOperator:=true; FIdentComplAddAssignOperator:=true;
FIdentComplAddDo:=true; FIdentComplAddDo:=true;
FIdentComplAutoInvokeOnType:=False;
FIdentComplOnTypeUseTimer:=true;
FIdentComplOnTypeOnlyWordEnd:=true;
FIdentComplOnTypeMinLength:=2;
FIdentComplAutoStartAfterPoint:=true; FIdentComplAutoStartAfterPoint:=true;
FIdentComplAutoUseSingleIdent:=true; FIdentComplAutoUseSingleIdent:=true;
FIdentComplUseContainsFilter:=true; FIdentComplUseContainsFilter:=true;
@ -1062,6 +1098,10 @@ begin
and (FIdentComplAddSemicolon=CodeToolsOpts.FIdentComplAddSemicolon) and (FIdentComplAddSemicolon=CodeToolsOpts.FIdentComplAddSemicolon)
and (FIdentComplAddAssignOperator=CodeToolsOpts.FIdentComplAddAssignOperator) and (FIdentComplAddAssignOperator=CodeToolsOpts.FIdentComplAddAssignOperator)
and (FIdentComplAddDo=CodeToolsOpts.FIdentComplAddDo) and (FIdentComplAddDo=CodeToolsOpts.FIdentComplAddDo)
and (FIdentComplAutoInvokeOnType=CodeToolsOpts.FIdentComplAutoInvokeOnType)
and (FIdentComplOnTypeUseTimer=CodeToolsOpts.FIdentComplOnTypeUseTimer)
and (FIdentComplOnTypeOnlyWordEnd=CodeToolsOpts.FIdentComplOnTypeOnlyWordEnd)
and (FIdentComplOnTypeMinLength=CodeToolsOpts.FIdentComplOnTypeMinLength)
and (FIdentComplAutoStartAfterPoint=CodeToolsOpts.FIdentComplAutoStartAfterPoint) and (FIdentComplAutoStartAfterPoint=CodeToolsOpts.FIdentComplAutoStartAfterPoint)
and (FIdentComplAutoUseSingleIdent=CodeToolsOpts.FIdentComplAutoUseSingleIdent) and (FIdentComplAutoUseSingleIdent=CodeToolsOpts.FIdentComplAutoUseSingleIdent)
and (FIdentComplUseContainsFilter=CodeToolsOpts.FIdentComplUseContainsFilter) and (FIdentComplUseContainsFilter=CodeToolsOpts.FIdentComplUseContainsFilter)

View File

@ -16,10 +16,10 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 19 Height = 19
Top = 99 Top = 179
Width = 161 Width = 162
Caption = 'ICAddSemicolonCheckBox' Caption = 'ICAddSemicolonCheckBox'
TabOrder = 3 TabOrder = 7
end end
object ICAddAssignOperatorCheckBox: TCheckBox object ICAddAssignOperatorCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -28,12 +28,12 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 19 Height = 19
Top = 118 Top = 198
Width = 187 Width = 188
Caption = 'ICAddAssignOperatorCheckBox' Caption = 'ICAddAssignOperatorCheckBox'
TabOrder = 4 TabOrder = 8
end end
object ICAutoStartAfterPointCheckBox: TCheckBox object ICAutoInvokeOnTypeCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ICOpenDividerBevel AnchorSideTop.Control = ICOpenDividerBevel
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
@ -41,10 +41,22 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
Left = 0 Left = 0
Height = 19 Height = 19
Top = 25 Top = 25
Width = 187 Width = 186
Caption = 'ICAutoStartAfterPointCheckBox' Caption = 'ICAutoInvokeOnTypeCheckBox'
TabOrder = 0 TabOrder = 0
end end
object ICAutoStartAfterPointCheckBox: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ICAutoOnTypeMinLength
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 0
Height = 19
Top = 105
Width = 188
Caption = 'ICAutoStartAfterPointCheckBox'
TabOrder = 4
end
object ICAutoAddParameterBracketsCheckBox: TCheckBox object ICAutoAddParameterBracketsCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ICAddDoCheckBox AnchorSideTop.Control = ICAddDoCheckBox
@ -52,10 +64,10 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 19 Height = 19
Top = 156 Top = 236
Width = 229 Width = 230
Caption = 'ICAutoAddParameterBracketsCheckBox' Caption = 'ICAutoAddParameterBracketsCheckBox'
TabOrder = 6 TabOrder = 10
end end
object ICShowHelpCheckBox: TCheckBox object ICShowHelpCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -64,12 +76,12 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 19 Height = 19
Top = 63 Top = 143
Width = 137 Width = 138
Caption = 'ICShowHelpCheckBox' Caption = 'ICShowHelpCheckBox'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 2 TabOrder = 6
end end
object ICReplaceCheckBox: TCheckBox object ICReplaceCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -78,12 +90,12 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 19 Height = 19
Top = 365 Top = 445
Width = 124 Width = 125
Caption = 'ICReplaceCheckBox' Caption = 'ICReplaceCheckBox'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 13 TabOrder = 16
end end
object ICAddDoCheckBox: TCheckBox object ICAddDoCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -92,10 +104,10 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 19 Height = 19
Top = 137 Top = 217
Width = 120 Width = 121
Caption = 'ICAddDoCheckBox' Caption = 'ICAddDoCheckBox'
TabOrder = 5 TabOrder = 9
end end
object ICSortForHistoryCheckBox: TCheckBox object ICSortForHistoryCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -103,10 +115,10 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 0 Left = 0
Height = 19 Height = 19
Top = 192 Top = 272
Width = 159 Width = 160
Caption = 'ICSortForHistoryCheckBox' Caption = 'ICSortForHistoryCheckBox'
TabOrder = 7 TabOrder = 11
end end
object ICSortForScopeCheckBox: TCheckBox object ICSortForScopeCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -114,12 +126,12 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 0 Left = 0
Height = 19 Height = 19
Top = 211 Top = 291
Width = 153 Width = 154
Caption = 'ICSortForScopeCheckBox' Caption = 'ICSortForScopeCheckBox'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 8 TabOrder = 12
end end
object ICOpenDividerBevel: TDividerBevel object ICOpenDividerBevel: TDividerBevel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -142,7 +154,7 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 15 Height = 15
Top = 84 Top = 164
Width = 537 Width = 537
Caption = 'ICAddDividerBevel' Caption = 'ICAddDividerBevel'
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
@ -158,7 +170,7 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 15 Height = 15
Top = 177 Top = 257
Width = 537 Width = 537
Caption = 'ICSortDividerBevel' Caption = 'ICSortDividerBevel'
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
@ -174,7 +186,7 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 15 Height = 15
Top = 350 Top = 430
Width = 537 Width = 537
Caption = 'ICMiscDividerBevel' Caption = 'ICMiscDividerBevel'
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
@ -189,26 +201,27 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 19 Height = 19
Top = 384 Top = 464
Width = 151 Width = 151
Caption = 'ICJumpToErrorCheckBox' Caption = 'ICJumpToErrorCheckBox'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 14 TabOrder = 17
end end
object ICAutoUseSingleIdent: TCheckBox object ICAutoUseSingleIdent: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ICAutoStartAfterPointCheckBox AnchorSideTop.Control = ICAutoStartAfterPointCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 20
Height = 19 Height = 19
Top = 44 Top = 124
Width = 135 Width = 135
BorderSpacing.Left = 20
Caption = 'ICAutoUseSingleIdent' Caption = 'ICAutoUseSingleIdent'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 1 TabOrder = 5
end end
object ICContainsFilterCheckBox: TCheckBox object ICContainsFilterCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -216,10 +229,10 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 0 Left = 0
Height = 19 Height = 19
Top = 247 Top = 327
Width = 156 Width = 157
Caption = 'ICContainsFilterCheckBox' Caption = 'ICContainsFilterCheckBox'
TabOrder = 9 TabOrder = 18
end end
object ICAppearanceDividerBevel: TDividerBevel object ICAppearanceDividerBevel: TDividerBevel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -229,7 +242,7 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 15 Height = 15
Top = 314 Top = 394
Width = 537 Width = 537
Caption = 'ICAppearanceDividerBevel' Caption = 'ICAppearanceDividerBevel'
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
@ -243,10 +256,10 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 0 Left = 0
Height = 19 Height = 19
Top = 329 Top = 409
Width = 222 Width = 224
Caption = 'ICUseIconsInCompletionBoxCheckBox' Caption = 'ICUseIconsInCompletionBoxCheckBox'
TabOrder = 12 TabOrder = 15
end end
object ICContentDividerBevel: TDividerBevel object ICContentDividerBevel: TDividerBevel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -256,7 +269,7 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 15 Height = 15
Top = 232 Top = 312
Width = 537 Width = 537
Caption = 'ICContentDividerBevel' Caption = 'ICContentDividerBevel'
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
@ -269,7 +282,7 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 0 Left = 0
Height = 15 Height = 15
Top = 272 Top = 352
Width = 112 Width = 112
Caption = 'ICIncludeWordsLabel' Caption = 'ICIncludeWordsLabel'
ParentColor = False ParentColor = False
@ -281,13 +294,13 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 117 Left = 117
Height = 23 Height = 23
Top = 268 Top = 348
Width = 200 Width = 200
BorderSpacing.Left = 5 BorderSpacing.Left = 5
BorderSpacing.Top = 2 BorderSpacing.Top = 2
ItemHeight = 15 ItemHeight = 15
Style = csDropDownList Style = csDropDownList
TabOrder = 10 TabOrder = 13
end end
object ICIncludeCodeTemplatesCheckBox: TCheckBox object ICIncludeCodeTemplatesCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -295,10 +308,67 @@ object CodetoolsIndentifierCompletionOptionsFrame: TCodetoolsIndentifierCompleti
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 0 Left = 0
Height = 19 Height = 19
Top = 293 Top = 373
Width = 205 Width = 205
BorderSpacing.Top = 2 BorderSpacing.Top = 2
Caption = 'ICIncludeCodeTemplatesCheckBox' Caption = 'ICIncludeCodeTemplatesCheckBox'
TabOrder = 11 TabOrder = 14
end
object ICAutoOnTypeUseTimer: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ICAutoInvokeOnTypeCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 20
Height = 19
Top = 44
Width = 147
BorderSpacing.Left = 20
Caption = 'ICAutoOnTypeUseTimer'
ParentShowHint = False
ShowHint = True
TabOrder = 1
end
object ICAutoOnTypeOnlyWordEnd: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ICAutoOnTypeUseTimer
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 20
Height = 19
Top = 63
Width = 172
BorderSpacing.Left = 20
Caption = 'ICAutoOnTypeOnlyWordEnd'
ParentShowHint = False
ShowHint = True
TabOrder = 2
end
object ICAutoOnTypeMinLengthLbl: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ICAutoOnTypeMinLength
AnchorSideTop.Side = asrCenter
Left = 20
Height = 15
Top = 86
Width = 151
BorderSpacing.Left = 20
Caption = 'ICAutoOnTypeMinLengthLbl'
ParentColor = False
end
object ICAutoOnTypeMinLength: TSpinEdit
AnchorSideLeft.Control = ICAutoOnTypeMinLengthLbl
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ICAutoOnTypeOnlyWordEnd
AnchorSideTop.Side = asrBottom
Left = 176
Height = 23
Top = 82
Width = 50
BorderSpacing.Left = 5
MaxValue = 99
MinValue = 1
TabOrder = 3
Value = 2
end end
end end

View File

@ -27,7 +27,7 @@ interface
uses uses
SysUtils, SysUtils,
// LCL // LCL
Forms, StdCtrls, Forms, StdCtrls, Spin,
// LazControls // LazControls
DividerBevel, DividerBevel,
// IdeIntf // IdeIntf
@ -41,12 +41,15 @@ type
TCodetoolsIndentifierCompletionOptionsFrame = class(TAbstractIDEOptionsEditor) TCodetoolsIndentifierCompletionOptionsFrame = class(TAbstractIDEOptionsEditor)
ICAddWordsComboBox: TComboBox; ICAddWordsComboBox: TComboBox;
ICAutoOnTypeUseTimer: TCheckBox;
ICAutoOnTypeOnlyWordEnd: TCheckBox;
ICContainsFilterCheckBox: TCheckBox; ICContainsFilterCheckBox: TCheckBox;
ICAddDoCheckBox: TCheckBox; ICAddDoCheckBox: TCheckBox;
ICAutoAddParameterBracketsCheckBox: TCheckBox; ICAutoAddParameterBracketsCheckBox: TCheckBox;
ICIncludeCodeTemplatesCheckBox: TCheckBox; ICIncludeCodeTemplatesCheckBox: TCheckBox;
ICMiscDividerBevel: TDividerBevel; ICMiscDividerBevel: TDividerBevel;
ICOpenDividerBevel: TDividerBevel; ICOpenDividerBevel: TDividerBevel;
ICAutoInvokeOnTypeCheckBox: TCheckBox;
ICAutoStartAfterPointCheckBox: TCheckBox; ICAutoStartAfterPointCheckBox: TCheckBox;
ICAddAssignOperatorCheckBox: TCheckBox; ICAddAssignOperatorCheckBox: TCheckBox;
ICAddSemicolonCheckBox: TCheckBox; ICAddSemicolonCheckBox: TCheckBox;
@ -62,6 +65,8 @@ type
ICSortForScopeCheckBox: TCheckBox; ICSortForScopeCheckBox: TCheckBox;
ICUseIconsInCompletionBoxCheckBox: TCheckBox; ICUseIconsInCompletionBoxCheckBox: TCheckBox;
ICIncludeWordsLabel: TLabel; ICIncludeWordsLabel: TLabel;
ICAutoOnTypeMinLengthLbl: TLabel;
ICAutoOnTypeMinLength: TSpinEdit;
private private
public public
function GetTitle: String; override; function GetTitle: String; override;
@ -86,6 +91,10 @@ procedure TCodetoolsIndentifierCompletionOptionsFrame.Setup(
ADialog: TAbstractOptionsEditorDialog); ADialog: TAbstractOptionsEditorDialog);
begin begin
ICOpenDividerBevel.Caption:=lisIdCOpening; ICOpenDividerBevel.Caption:=lisIdCOpening;
ICAutoInvokeOnTypeCheckBox.Caption:=lisAutomaticallyInvokeOnType;
ICAutoOnTypeUseTimer.Caption:=lisAutomaticallyInvokeOnTypeUseTimer;
ICAutoOnTypeOnlyWordEnd.Caption:=lisAutomaticallyInvokeOnTypeOnlyWordEnd;
ICAutoOnTypeMinLengthLbl.Caption:=lisAutomaticallyInvokeOnTypeMinLength;
ICAutoStartAfterPointCheckBox.Caption:=lisAutomaticallyInvokeAfterPoint; ICAutoStartAfterPointCheckBox.Caption:=lisAutomaticallyInvokeAfterPoint;
ICAutoUseSingleIdent.Caption:=lisAutomaticallyUseSinglePossibleIdent; ICAutoUseSingleIdent.Caption:=lisAutomaticallyUseSinglePossibleIdent;
ICAutoUseSingleIdent.Hint:= ICAutoUseSingleIdent.Hint:=
@ -131,6 +140,10 @@ begin
ICAddSemicolonCheckBox.Checked := IdentComplAddSemicolon; ICAddSemicolonCheckBox.Checked := IdentComplAddSemicolon;
ICAddAssignOperatorCheckBox.Checked := IdentComplAddAssignOperator; ICAddAssignOperatorCheckBox.Checked := IdentComplAddAssignOperator;
ICAddDoCheckBox.Checked := IdentComplAddDo; ICAddDoCheckBox.Checked := IdentComplAddDo;
ICAutoInvokeOnTypeCheckBox.Checked := IdentComplAutoInvokeOnType;
ICAutoOnTypeUseTimer.Checked := IdentComplOnTypeUseTimer;
ICAutoOnTypeOnlyWordEnd.Checked := IdentComplOnTypeOnlyWordEnd;
ICAutoOnTypeMinLength.Value := IdentComplOnTypeMinLength;
ICAutoStartAfterPointCheckBox.Checked := IdentComplAutoStartAfterPoint; ICAutoStartAfterPointCheckBox.Checked := IdentComplAutoStartAfterPoint;
ICAutoUseSingleIdent.Checked := IdentComplAutoUseSingleIdent; ICAutoUseSingleIdent.Checked := IdentComplAutoUseSingleIdent;
ICAutoAddParameterBracketsCheckBox.Checked:=IdentComplAddParameterBrackets; ICAutoAddParameterBracketsCheckBox.Checked:=IdentComplAddParameterBrackets;
@ -159,6 +172,10 @@ begin
IdentComplAddSemicolon := ICAddSemicolonCheckBox.Checked; IdentComplAddSemicolon := ICAddSemicolonCheckBox.Checked;
IdentComplAddAssignOperator := ICAddAssignOperatorCheckBox.Checked; IdentComplAddAssignOperator := ICAddAssignOperatorCheckBox.Checked;
IdentComplAddDo := ICAddDoCheckBox.Checked; IdentComplAddDo := ICAddDoCheckBox.Checked;
IdentComplAutoInvokeOnType := ICAutoInvokeOnTypeCheckBox.Checked;
IdentComplOnTypeUseTimer := ICAutoOnTypeUseTimer.Checked;
IdentComplOnTypeOnlyWordEnd := ICAutoOnTypeOnlyWordEnd.Checked;
IdentComplOnTypeMinLength := ICAutoOnTypeMinLength.Value;
IdentComplAutoStartAfterPoint := ICAutoStartAfterPointCheckBox.Checked; IdentComplAutoStartAfterPoint := ICAutoStartAfterPointCheckBox.Checked;
IdentComplAutoUseSingleIdent := ICAutoUseSingleIdent.Checked; IdentComplAutoUseSingleIdent := ICAutoUseSingleIdent.Checked;
IdentComplAddParameterBrackets:=ICAutoAddParameterBracketsCheckBox.Checked; IdentComplAddParameterBrackets:=ICAutoAddParameterBracketsCheckBox.Checked;

View File

@ -5962,6 +5962,10 @@ resourcestring
+'exist. Values were not checked.'; +'exist. Values were not checked.';
lisInsertPrintShortTag = 'Insert PrintShort tag'; lisInsertPrintShortTag = 'Insert PrintShort tag';
lisIdCOpening = 'Opening'; lisIdCOpening = 'Opening';
lisAutomaticallyInvokeOnType = 'Automatically invoke on typing';
lisAutomaticallyInvokeOnTypeUseTimer = 'Use completion box delay';
lisAutomaticallyInvokeOnTypeOnlyWordEnd = 'Only complete when at end of word';
lisAutomaticallyInvokeOnTypeMinLength = 'Only complete if word is longer or equal';
lisAutomaticallyInvokeAfterPoint = 'Automatically invoke after point'; lisAutomaticallyInvokeAfterPoint = 'Automatically invoke after point';
lisAutomaticallyUseSinglePossibleIdent = 'Automatically use single possible identifier'; lisAutomaticallyUseSinglePossibleIdent = 'Automatically use single possible identifier';
lisWhenThereIsOnlyOnePossibleCompletionItemUseItImmed = 'When there is only ' lisWhenThereIsOnlyOnePossibleCompletionItemUseItImmed = 'When there is only '

View File

@ -248,6 +248,10 @@ type
// when text is inserted/deleted // when text is inserted/deleted
FOnIfdefNodeStateRequest: TSynMarkupIfdefStateRequest; FOnIfdefNodeStateRequest: TSynMarkupIfdefStateRequest;
FLastIfDefNodeScannerStep: integer; FLastIfDefNodeScannerStep: integer;
FCodeCompletionState: record
State: (ccsReady, ccsCancelled, ccsDot, ccsOnTyping, ccsOnTypingScheduled);
LastTokenStartPos: TPoint;
end;
FSyncroLockCount: Integer; FSyncroLockCount: Integer;
FPageName: string; FPageName: string;
@ -462,7 +466,10 @@ type
procedure MoveToWindow(AWindowIndex: Integer); override; procedure MoveToWindow(AWindowIndex: Integer); override;
procedure CopyToWindow(AWindowIndex: Integer); override; procedure CopyToWindow(AWindowIndex: Integer); override;
function GetCodeAttributeName(LogXY: TPoint): String;
// used to get the word at the mouse cursor // used to get the word at the mouse cursor
function CurrentWordLogStartOrCaret: TPoint;
function GetWordFromCaret(const ACaretPos: TPoint): String; function GetWordFromCaret(const ACaretPos: TPoint): String;
function GetWordAtCurrentCaret: String; function GetWordAtCurrentCaret: String;
function GetOperandFromCaret(const ACaretPos: TPoint): String; function GetOperandFromCaret(const ACaretPos: TPoint): String;
@ -2135,6 +2142,8 @@ begin
FAutoHideHintTimer.Enabled := False; FAutoHideHintTimer.Enabled := False;
if AutoStartCompletionBoxTimer<>nil then if AutoStartCompletionBoxTimer<>nil then
AutoStartCompletionBoxTimer.Enabled:=false; AutoStartCompletionBoxTimer.Enabled:=false;
if FManager.ActiveEditor.FCodeCompletionState.State in [ccsDot, ccsOnTyping] then
FManager.ActiveEditor.FCodeCompletionState.State := ccsReady;
if FAutoShown then if FAutoShown then
HideHint; HideHint;
end; end;
@ -2389,6 +2398,11 @@ begin
end; end;
//debugln(GetStackTrace(true)); //debugln(GetStackTrace(true));
{$ENDIF} {$ENDIF}
with Manager.ActiveEditor do begin
FCodeCompletionState.LastTokenStartPos := CurrentWordLogStartOrCaret;
FCodeCompletionState.State := ccsCancelled;
end;
end; end;
procedure TSourceEditCompletion.ccComplete(var Value: string; procedure TSourceEditCompletion.ccComplete(var Value: string;
@ -2516,10 +2530,12 @@ Begin
Manager.DeactivateCompletionForm; Manager.DeactivateCompletionForm;
//DebugLn(['TSourceNotebook.ccComplete ',KeyChar,' ',OldCompletionType=ctIdentCompletion]); //DebugLn(['TSourceNotebook.ccComplete ',KeyChar,' ',OldCompletionType=ctIdentCompletion]);
Manager.ActiveEditor.FCodeCompletionState.State := ccsReady;
if (KeyChar='.') and (OldCompletionType=ctIdentCompletion) then if (KeyChar='.') and (OldCompletionType=ctIdentCompletion) then
begin begin
SourceCompletionCaretXY:=Editor.LogicalCaretXY; SourceCompletionCaretXY:=Editor.LogicalCaretXY;
AutoStartCompletionBoxTimer.AutoEnabled:=true; AutoStartCompletionBoxTimer.AutoEnabled:=true;
Manager.ActiveEditor.FCodeCompletionState.State := ccsDot;
end end
else if prototypeAdded and EditorOpts.AutoDisplayFunctionPrototypes then else if prototypeAdded and EditorOpts.AutoDisplayFunctionPrototypes then
begin begin
@ -3876,13 +3892,16 @@ procedure TSourceEditor.ProcessCommand(Sender: TObject;
// define extra actions here // define extra actions here
// for non synedit keys (bigger than ecUserFirst) use ProcessUserCommand // for non synedit keys (bigger than ecUserFirst) use ProcessUserCommand
var var
AddChar: Boolean; AddChar, IsIdent, ok: Boolean;
s: String; s, AttrName: String;
i: Integer; i, WordStart, WordEnd: Integer;
p: TPoint;
begin begin
//DebugLn('TSourceEditor.ProcessCommand Command=',dbgs(Command)); //DebugLn('TSourceEditor.ProcessCommand Command=',dbgs(Command));
FSharedValues.SetActiveSharedEditor(Self); FSharedValues.SetActiveSharedEditor(Self);
AutoStartCompletionBoxTimer.AutoEnabled:=false; AutoStartCompletionBoxTimer.AutoEnabled:=false;
if FCodeCompletionState.State in [ccsDot, ccsOnTyping] then
FCodeCompletionState.State := ccsReady;
if (Command=ecChar) and (AChar=#27) then begin if (Command=ecChar) and (AChar=#27) then begin
// close hint windows // close hint windows
@ -3969,19 +3988,62 @@ begin
ecChar: ecChar:
begin begin
AddChar:=true; AddChar:=true;
IsIdent:=FEditor.IsIdentChar(aChar);
//debugln(['TSourceEditor.ProcessCommand AChar="',AChar,'" AutoIdentifierCompletion=',dbgs(EditorOpts.AutoIdentifierCompletion),' Interval=',AutoStartCompletionBoxTimer.Interval,' ',Dbgs(FEditor.CaretXY),' ',FEditor.IsIdentChar(aChar)]); //debugln(['TSourceEditor.ProcessCommand AChar="',AChar,'" AutoIdentifierCompletion=',dbgs(EditorOpts.AutoIdentifierCompletion),' Interval=',AutoStartCompletionBoxTimer.Interval,' ',Dbgs(FEditor.CaretXY),' ',FEditor.IsIdentChar(aChar)]);
if (aChar=' ') and AutoCompleteChar(aChar,AddChar,acoSpace) then begin if (aChar=' ') and AutoCompleteChar(aChar,AddChar,acoSpace) then begin
// completed // completed
end end
else if (not FEditor.IsIdentChar(aChar)) else
if (not IsIdent)
and AutoCompleteChar(aChar,AddChar,acoWordEnd) then begin and AutoCompleteChar(aChar,AddChar,acoWordEnd) then begin
// completed // completed
end else if CodeToolsOpts.IdentComplAutoStartAfterPoint then begin end
// store caret position to detect caret changes else
if CodeToolsOpts.IdentComplAutoInvokeOnType and
( IsIdent or (AChar='.') )
then begin
// store caret position to detect caret changes // add the char
p := FEditor.LogicalCaretXY;
SourceCompletionCaretXY:=p;
inc(SourceCompletionCaretXY.x,length(AChar));
AttrName := GetCodeAttributeName(p);
ok := (AttrName <> SYNS_XML_AttrComment) and
(AttrName <> SYNS_XML_AttrDirective) and
(AttrName <> SYNS_XML_AttrString);
if ok then begin
if AChar = '.' then begin
ok := CodeToolsOpts.IdentComplAutoStartAfterPoint;
end
else
if (CodeToolsOpts.IdentComplOnTypeMinLength > 1) or CodeToolsOpts.IdentComplOnTypeOnlyWordEnd
then begin
FEditor.GetWordBoundsAtRowCol(p, WordStart, WordEnd);
ok := (p.x <= WordEnd) and // inside word
((not CodeToolsOpts.IdentComplOnTypeOnlyWordEnd) or (p.x = WordEnd)) and // at word end?
((WordEnd-WordStart+1) >= CodeToolsOpts.IdentComplOnTypeMinLength);
end;
end;
if ok then begin
if CodeToolsOpts.IdentComplOnTypeUseTimer then begin
AutoStartCompletionBoxTimer.AutoEnabled:=true;
FCodeCompletionState.State := ccsOnTyping;
end
else begin
FCodeCompletionState.State := ccsOnTypingScheduled;
end;
end;
end
else
if CodeToolsOpts.IdentComplAutoStartAfterPoint and
(AChar='.')
then begin
// store caret position to detect caret changes // add the char
SourceCompletionCaretXY:=FEditor.LogicalCaretXY; SourceCompletionCaretXY:=FEditor.LogicalCaretXY;
// add the char
inc(SourceCompletionCaretXY.x,length(AChar)); inc(SourceCompletionCaretXY.x,length(AChar));
AutoStartCompletionBoxTimer.AutoEnabled:=true; AutoStartCompletionBoxTimer.AutoEnabled:=true;
FCodeCompletionState.State := ccsDot;
end; end;
//DebugLn(['TSourceEditor.ProcessCommand ecChar AddChar=',AddChar]); //DebugLn(['TSourceEditor.ProcessCommand ecChar AddChar=',AddChar]);
if not AddChar then Command:=ecNone; if not AddChar then Command:=ecNone;
@ -4138,8 +4200,15 @@ procedure TSourceEditor.UserCommandProcessed(Sender: TObject;
var Handled: boolean; var Handled: boolean;
begin begin
Handled:=true; Handled:=true;
case Command of
if (Command <> ecCompleteCode) and (Command <> ecCompleteCodeInteractive) and
(FCodeCompletionState.State = ccsCancelled)
then begin
if CompareCaret(FCodeCompletionState.LastTokenStartPos, CurrentWordLogStartOrCaret) <> 0 then
FCodeCompletionState.State := ccsReady;
end;
case Command of
ecNone: ; ecNone: ;
ecChar: ecChar:
@ -4149,6 +4218,11 @@ begin
if EditorOpts.AutoDisplayFunctionPrototypes then if EditorOpts.AutoDisplayFunctionPrototypes then
if (aChar = '(') or (aChar = ',') then if (aChar = '(') or (aChar = ',') then
SourceNotebook.StartShowCodeContext(False); SourceNotebook.StartShowCodeContext(False);
if FCodeCompletionState.State = ccsOnTypingScheduled then begin
FCodeCompletionState.State := ccsOnTyping;
StartIdentCompletionBox(false,false);
end;
end; end;
else else
@ -5195,7 +5269,9 @@ begin
if UseWordCompletion then if UseWordCompletion then
Completion.CurrentCompletionType:=ctWordCompletion; Completion.CurrentCompletionType:=ctWordCompletion;
Completion.AutoUseSingleIdent := CanAutoComplete and CodeToolsOpts.IdentComplAutoUseSingleIdent; Completion.AutoUseSingleIdent := CanAutoComplete and
(FCodeCompletionState.State = ccsDot) and
CodeToolsOpts.IdentComplAutoUseSingleIdent;
Completion.Execute(TextS2, CompletionRect); Completion.Execute(TextS2, CompletionRect);
{$IFDEF VerboseIDECompletionBox} {$IFDEF VerboseIDECompletionBox}
debugln(['TSourceEditor.StartIdentCompletionBox END Completion.TheForm.Visible=',Completion.TheForm.Visible]); debugln(['TSourceEditor.StartIdentCompletionBox END Completion.TheForm.Visible=',Completion.TheForm.Visible]);
@ -5834,6 +5910,16 @@ begin
FEditor.Lines:=AValue; FEditor.Lines:=AValue;
end; end;
function TSourceEditor.CurrentWordLogStartOrCaret: TPoint;
var
StartX, EndX: integer;
begin
Result := FEditor.LogicalCaretXY;
FEditor.GetWordBoundsAtRowCol(Result, StartX, EndX);
if (Result.x >= StartX) and (Result.x <= EndX) then
Result.x := StartX;
end;
function TSourceEditor.GetProjectFile: TLazProjectFile; function TSourceEditor.GetProjectFile: TLazProjectFile;
begin begin
Result:=LazarusIDE.GetProjectFileForProjectEditor(Self); Result:=LazarusIDE.GetProjectFileForProjectEditor(Self);
@ -6118,6 +6204,19 @@ begin
SourceNotebook.CopyEditor(PageIndex, AWindowIndex, -1) SourceNotebook.CopyEditor(PageIndex, AWindowIndex, -1)
end; end;
function TSourceEditor.GetCodeAttributeName(LogXY: TPoint): String;
var
Token: string;
Attri: TSynHighlighterAttributes;
begin
Result := '';
if EditorComponent.GetHighlighterAttriAtRowCol(LogXY,Token,Attri)
and (Attri<>nil) then
begin
Result := Attri.StoredName;
end;
end;
procedure TSourceEditor.LineInfoNotificationChange(const ASender: TObject; const ASource: String); procedure TSourceEditor.LineInfoNotificationChange(const ASender: TObject; const ASource: String);
begin begin
if ASource = FileName then begin if ASource = FileName then begin
@ -11042,25 +11141,15 @@ procedure TSourceEditorManager.OnSourceCompletionTimer(Sender: TObject);
function CheckCodeAttribute (XY: TPoint; out CodeAttri: String): Boolean; function CheckCodeAttribute (XY: TPoint; out CodeAttri: String): Boolean;
var var
SrcEdit: TSourceEditor; SrcEdit: TSourceEditor;
Token: string;
Attri: TSynHighlighterAttributes;
begin begin
Result := False; Result := False;
SrcEdit := ActiveEditor; SrcEdit := ActiveEditor;
if SrcEdit = nil then exit; if SrcEdit = nil then exit;
Token:='';
Attri:=nil;
dec(XY.X); dec(XY.X);
if SrcEdit.EditorComponent.GetHighlighterAttriAtRowCol(XY,Token,Attri) CodeAttri := SrcEdit.GetCodeAttributeName(XY);
and (Attri<>nil) then Result := CodeAttri <> '';
begin
CodeAttri := Attri.StoredName;
Result := True;
end;
end; end;
function CheckStartIdentCompletion: boolean; function CheckStartIdentCompletion: boolean;
@ -11069,7 +11158,6 @@ procedure TSourceEditorManager.OnSourceCompletionTimer(Sender: TObject);
LogCaret: TPoint; LogCaret: TPoint;
SrcEdit: TSourceEditor; SrcEdit: TSourceEditor;
CodeAttribute: String; CodeAttribute: String;
aChar: Char;
begin begin
Result := false; Result := false;
SrcEdit := ActiveEditor; SrcEdit := ActiveEditor;
@ -11083,7 +11171,8 @@ procedure TSourceEditorManager.OnSourceCompletionTimer(Sender: TObject);
// check if last character is a point // check if last character is a point
if (Line='') or (LogCaret.X<=1) or (LogCaret.X-1>length(Line)) if (Line='') or (LogCaret.X<=1) or (LogCaret.X-1>length(Line))
or (Line[LogCaret.X-1]<>'.') then or ((SrcEdit.FCodeCompletionState.State = ccsDot) and (Line[LogCaret.X-1]<>'.'))
then
exit; exit;
if not CheckCodeAttribute(LogCaret, CodeAttribute) then if not CheckCodeAttribute(LogCaret, CodeAttribute) then