codetools: code completion: check completing method body to header as last check, patch #28819 from Ondrej

git-svn-id: trunk@50067 -
This commit is contained in:
mattias 2015-10-14 23:21:24 +00:00
parent ea8b3ac796
commit bfea0890b0

View File

@ -9141,7 +9141,7 @@ function TCodeCompletionCodeTool.CompleteCode(CursorPos: TCodeXYPosition;
if Result then exit;
end;
function TryComplete(CursorNode: TCodeTreeNode; CleanCursorPos, OrigCleanCursorPos: integer): Boolean;
function TryComplete(CursorNode: TCodeTreeNode; CleanCursorPos: integer): Boolean;
var
ProcNode, AClassNode: TCodeTreeNode;
IsEventAssignment: boolean;
@ -9200,12 +9200,6 @@ function TCodeCompletionCodeTool.CompleteCode(CursorPos: TCodeXYPosition;
Result:=CompleteProcByCall(CleanCursorPos,OldTopLine,
CursorNode,NewPos,NewTopLine,SourceChangeCache);
if Result then exit;
// test if method body
if OrigCleanCursorPos <> -1 then
Result:=CompleteMethodByBody(OrigCleanCursorPos,OldTopLine,CursorNode,
NewPos,NewTopLine,SourceChangeCache);
if Result then exit;
finally
FCompletingCursorNode:=nil;
end;
@ -9320,7 +9314,7 @@ begin
CodeCompleteSrcChgCache:=SourceChangeCache;
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
if TryComplete(CursorNode, CleanCursorPos, OrigCleanCursorPos) then
if TryComplete(CursorNode, CleanCursorPos) then
exit(true);
{ Find the first occurence of the (local) identifier at cursor in current
@ -9328,6 +9322,11 @@ begin
if TryFirstLocalIdentOccurence(CursorNode,OrigCleanCursorPos,CleanCursorPos) then
exit(true);
if CompleteMethodByBody(OrigCleanCursorPos,OldTopLine,CursorNode,
NewPos,NewTopLine,SourceChangeCache)
then
exit(true);
{$IFDEF CTDEBUG}
DebugLn('TCodeCompletionCodeTool.CompleteCode nothing to complete ... ');
{$ENDIF}