codetools: local var completion: always check the identifier at cursor first

git-svn-id: trunk@50053 -
This commit is contained in:
mattias 2015-10-14 10:51:53 +00:00
parent b5bbdbd323
commit d76225f6d7

View File

@ -9320,12 +9320,13 @@ begin
CodeCompleteSrcChgCache:=SourceChangeCache; CodeCompleteSrcChgCache:=SourceChangeCache;
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true); CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
if TryComplete(CursorNode, CleanCursorPos, OrigCleanCursorPos) then
exit(true);
{ Find the first occurence of the (local) identifier at cursor in current { Find the first occurence of the (local) identifier at cursor in current
procedure body and try again. } procedure body and try again. }
Result:=TryFirstLocalIdentOccurence(CursorNode,OrigCleanCursorPos,CleanCursorPos); if TryFirstLocalIdentOccurence(CursorNode,OrigCleanCursorPos,CleanCursorPos) then
if Result then exit; exit(true);
if TryComplete(CursorNode, CleanCursorPos, OrigCleanCursorPos) then exit;
{$IFDEF CTDEBUG} {$IFDEF CTDEBUG}
DebugLn('TCodeCompletionCodeTool.CompleteCode nothing to complete ... '); DebugLn('TCodeCompletionCodeTool.CompleteCode nothing to complete ... ');