mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 00:11:51 +02:00
Keywords in Code Completion list, when auto invoke
This commit is contained in:
parent
1837c65413
commit
cb225ab6f1
@ -140,6 +140,7 @@ type
|
||||
FPascalTools: TAVLTree; // tree of TCustomCodeTool sorted TCustomCodeTool(Data).Scanner.MainCode
|
||||
FTabWidth: integer;
|
||||
FUseTabs: boolean;
|
||||
FIdentComplAutoInvokeOnType: Boolean;
|
||||
FVisibleEditorLines: integer;
|
||||
FWriteExceptions: boolean;
|
||||
FWriteLockCount: integer;// Set/Unset counter
|
||||
@ -324,6 +325,7 @@ type
|
||||
read FVisibleEditorLines write SetVisibleEditorLines;
|
||||
property TabWidth: integer read FTabWidth write SetTabWidth;
|
||||
property UseTabs: boolean read FUseTabs write SetUseTabs;
|
||||
property IdentComplAutoInvokeOnType: Boolean read FIdentComplAutoInvokeOnType write FIdentComplAutoInvokeOnType;
|
||||
property CompleteProperties: boolean
|
||||
read FCompleteProperties write SetCompleteProperties;
|
||||
property AddInheritedCodeToOverrideMethod: boolean
|
||||
|
@ -419,7 +419,7 @@ type
|
||||
procedure GatherUnitnames(const NameSpacePath: string = '');
|
||||
procedure GatherSourceNames(const Context: TFindContext);
|
||||
procedure GatherContextKeywords(const Context: TFindContext;
|
||||
CleanPos: integer; BeautifyCodeOptions: TBeautifyCodeOptions);
|
||||
CleanPos: integer; BeautifyCodeOptions: TBeautifyCodeOptions; GatherContext: TFindContext);
|
||||
procedure GatherUserIdentifiers(const ContextFlags: TIdentifierListContextFlags);
|
||||
procedure InitCollectIdentifiers(const CursorPos: TCodeXYPosition;
|
||||
var IdentifierList: TIdentifierList);
|
||||
@ -468,6 +468,9 @@ var
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
CodeToolManager;
|
||||
|
||||
const
|
||||
CompilerFuncHistoryIndex = 10;
|
||||
CompilerFuncLevel = 10;
|
||||
@ -1781,7 +1784,7 @@ end;
|
||||
|
||||
procedure TIdentCompletionTool.GatherContextKeywords(
|
||||
const Context: TFindContext; CleanPos: integer;
|
||||
BeautifyCodeOptions: TBeautifyCodeOptions);
|
||||
BeautifyCodeOptions: TBeautifyCodeOptions; GatherContext: TFindContext);
|
||||
type
|
||||
TPropertySpecifier = (
|
||||
psIndex,psRead,psWrite,psStored,psImplements,psDefault,psNoDefault
|
||||
@ -2079,6 +2082,53 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
ctnBeginBlock,ctnWithStatement,ctnWithVariable, ctnOnBlock,ctnOnIdentifier,ctnOnStatement:
|
||||
//ctnInitialization,ctnFinalization: //AllPascalStatements
|
||||
begin
|
||||
if CodeToolBoss.IdentComplAutoInvokeOnType then
|
||||
if not (GatherContext.Node.Desc in AllClassObjects) then
|
||||
begin
|
||||
if not (ilcfDontAllowProcedures in CurrentIdentifierList.ContextFlags) then
|
||||
begin
|
||||
Add('and');
|
||||
Add('asm');
|
||||
Add('begin');
|
||||
Add('case');
|
||||
Add('do');
|
||||
Add('downto');
|
||||
Add('else');
|
||||
Add('end');
|
||||
Add('except');
|
||||
Add('finally');
|
||||
Add('for');
|
||||
Add('goto');
|
||||
Add('if');
|
||||
Add('inherited');
|
||||
Add('label');
|
||||
Add('not');
|
||||
Add('of');
|
||||
Add('on');
|
||||
Add('or');
|
||||
Add('raise');
|
||||
Add('repeat');
|
||||
Add('then');
|
||||
Add('to');
|
||||
Add('try');
|
||||
Add('until');
|
||||
Add('while');
|
||||
Add('with');
|
||||
Add('xor');
|
||||
end;
|
||||
Add('div');
|
||||
Add('in');
|
||||
Add('as');
|
||||
Add('is');
|
||||
Add('mod');
|
||||
Add('shl');
|
||||
Add('shr');
|
||||
end;
|
||||
end;
|
||||
|
||||
ctnProperty:
|
||||
CheckProperty(Node);
|
||||
|
||||
@ -2982,9 +3032,6 @@ begin
|
||||
FindContextClassAndAncestorsAndExtendedClassOfHelper(IdentStartXY, FICTClassAndAncestorsAndExtClassOfHelper);
|
||||
end;
|
||||
|
||||
CursorContext:=CreateFindContext(Self,CursorNode);
|
||||
GatherContextKeywords(CursorContext,IdentStartPos,Beautifier);
|
||||
|
||||
// check for incomplete context
|
||||
|
||||
// context bracket level
|
||||
@ -3114,6 +3161,9 @@ begin
|
||||
CurrentIdentifierList.ContextFlags+[ilcfEndOfLine];
|
||||
end;
|
||||
|
||||
CursorContext:=CreateFindContext(Self,CursorNode);
|
||||
GatherContextKeywords(CursorContext, IdentStartPos, Beautifier, GatherContext); //note: coth:
|
||||
|
||||
// search and gather identifiers in context
|
||||
if (GatherContext.Tool<>nil) and (GatherContext.Node<>nil) then begin
|
||||
{$IFDEF CTDEBUG}
|
||||
|
@ -1174,6 +1174,7 @@ begin
|
||||
Boss.CursorBeyondEOL:=CursorBeyondEOL;
|
||||
Boss.AddInheritedCodeToOverrideMethod:=AddInheritedCodeToOverrideMethod;
|
||||
Boss.CompleteProperties:=CompleteProperties;
|
||||
Boss.IdentComplAutoInvokeOnType:=IdentComplAutoInvokeOnType;
|
||||
|
||||
// CreateCode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AssignTo(Boss.SourceChangeCache.BeautifyCodeOptions);
|
||||
|
Loading…
Reference in New Issue
Block a user