From a1d7624a8864b52710ffc26ed96d80e7ca90a570 Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 21 Jun 2011 15:01:29 +0000 Subject: [PATCH] codetools: fixed TIdentCompletionTool.ParseSourceTillCollectionStart check atom in front git-svn-id: trunk@31318 - --- components/codetools/customcodetool.pas | 2 +- components/codetools/identcompletiontool.pas | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/components/codetools/customcodetool.pas b/components/codetools/customcodetool.pas index f911d3749e..7201ed01ba 100644 --- a/components/codetools/customcodetool.pas +++ b/components/codetools/customcodetool.pas @@ -1719,7 +1719,7 @@ begin until false; ReadNextAtom; if CurPos.StartPos try prior node Node:=Node.Prior; until false; diff --git a/components/codetools/identcompletiontool.pas b/components/codetools/identcompletiontool.pas index e64b5c3af6..d1ae06be9e 100644 --- a/components/codetools/identcompletiontool.pas +++ b/components/codetools/identcompletiontool.pas @@ -1726,6 +1726,7 @@ procedure TIdentCompletionTool.ParseSourceTillCollectionStart( out CursorNode: TCodeTreeNode; out IdentStartPos, IdentEndPos: integer); var StartContext: TFindContext; + ContextPos: Integer; begin CleanCursorPos:=0; CursorNode:=nil; @@ -1740,7 +1741,19 @@ begin [btSetIgnoreErrorPos]); // find node at position - CursorNode:=BuildSubTreeAndFindDeepestNodeAtPos(CleanCursorPos,true); + ContextPos:=CleanCursorPos; + // The context node might be in front of the CleanCursorPos + // For example: A.|end; In this case the statement ends at the point. + // Check the atom in front + ReadPriorAtomSafe(CleanCursorPos); + if (CurPos.Flag<>cafNone) then begin + ContextPos:=CurPos.EndPos; + if (CurPos.Flag in [cafPoint,cafRoundBracketOpen,cafEdgedBracketOpen]) + or UpAtomIs('INHERITED') then + ContextPos:=CurPos.StartPos; + end; + + CursorNode:=BuildSubTreeAndFindDeepestNodeAtPos(ContextPos,true); if CurrentIdentifierList<>nil then begin StartContext:=CurrentIdentifierList.StartContext; StartContext.Node:=CursorNode;