mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-08 10:39:15 +02:00
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:
parent
ea8b3ac796
commit
bfea0890b0
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user