mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-05 15:20:38 +02:00
codetools: identifier completion: fixed keywords when cursor on a word
git-svn-id: trunk@58147 -
This commit is contained in:
parent
317bc74ea3
commit
75417ff3a2
@ -1837,21 +1837,30 @@ var
|
||||
Node: TCodeTreeNode;
|
||||
SubNode: TCodeTreeNode;
|
||||
NodeInFront: TCodeTreeNode;
|
||||
p: Integer;
|
||||
p, AtomStartPos: Integer;
|
||||
NodeBehind, LastChild: TCodeTreeNode;
|
||||
begin
|
||||
try
|
||||
Node:=Context.Node;
|
||||
//debugln(['TIdentCompletionTool.GatherContextKeywords ',Node.DescAsString]);
|
||||
if Node<>nil then begin
|
||||
MoveCursorToNearestAtom(CleanPos);
|
||||
AtomStartPos:=CurPos.StartPos;
|
||||
if (AtomStartPos=Node.StartPos) and (Node.Parent<>nil) then
|
||||
// at the start of the node -> the node is created by the atom at cursor
|
||||
// use parent as context
|
||||
Node:=Node.Parent;
|
||||
end else
|
||||
AtomStartPos:=CleanPos;
|
||||
//debugln(['TIdentCompletionTool.GatherContextKeywords Node=',Node.DescAsString]);
|
||||
|
||||
ReadPriorAtomSafe(CleanPos);
|
||||
//debugln(['TIdentCompletionTool.GatherContextKeywords prioratom=',CleanPosToStr(CurPos.StartPos),'=',GetAtom(CurPos)]);
|
||||
ReadPriorAtomSafe(AtomStartPos);
|
||||
//debugln(['TIdentCompletionTool.GatherContextKeywords prioratom=',CleanPosToStr(CurPos.StartPos),'="',GetAtom(CurPos),'"']);
|
||||
NodeInFront:=nil;
|
||||
if CurPos.StartPos>0 then
|
||||
NodeInFront:=FindDeepestNodeAtPos(CurPos.StartPos,false);
|
||||
|
||||
NodeBehind:=nil;
|
||||
MoveCursorToCleanPos(CleanPos);
|
||||
MoveCursorToCleanPos(AtomStartPos);
|
||||
ReadNextAtom;
|
||||
//debugln(['TIdentCompletionTool.GatherContextKeywords nextatom=',CleanPosToStr(CurPos.StartPos),'=',GetAtom(CurPos)]);
|
||||
if CurPos.StartPos>CleanPos then
|
||||
|
Loading…
Reference in New Issue
Block a user