mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 16:59:21 +02:00
codetools: code completion: add new methods: fixed adding in front of begin..end
git-svn-id: trunk@28515 -
This commit is contained in:
parent
24da9a3ae1
commit
3f492dc212
@ -6654,7 +6654,8 @@ var
|
|||||||
|
|
||||||
// find first method
|
// find first method
|
||||||
NearestProcNode:=StartSearchProc;
|
NearestProcNode:=StartSearchProc;
|
||||||
while (NearestProcNode<>nil) and (not NodeIsMethodBody(NearestProcNode)) do
|
while (NearestProcNode<>nil) and (NearestProcNode.Desc<>ctnBeginBlock)
|
||||||
|
and (not NodeIsMethodBody(NearestProcNode)) do
|
||||||
NearestProcNode:=NearestProcNode.NextBrother;
|
NearestProcNode:=NearestProcNode.NextBrother;
|
||||||
if NearestProcNode<>nil then begin
|
if NearestProcNode<>nil then begin
|
||||||
// the comments in front of the first method probably belong to the class
|
// the comments in front of the first method probably belong to the class
|
||||||
@ -6677,12 +6678,13 @@ var
|
|||||||
|
|
||||||
// find last method (go to last brother and search backwards)
|
// find last method (go to last brother and search backwards)
|
||||||
if (StartSearchProc<>nil)
|
if (StartSearchProc<>nil)
|
||||||
and (StartSearchProc.Parent<>nil) then
|
and (StartSearchProc.Parent<>nil) then begin
|
||||||
NearestProcNode:=StartSearchProc.Parent.LastChild;
|
NearestProcNode:=StartSearchProc.Parent.LastChild;
|
||||||
|
end;
|
||||||
while (NearestProcNode<>nil) and (not NodeIsMethodBody(NearestProcNode)) do
|
while (NearestProcNode<>nil) and (not NodeIsMethodBody(NearestProcNode)) do
|
||||||
NearestProcNode:=NearestProcNode.PriorBrother;
|
NearestProcNode:=NearestProcNode.PriorBrother;
|
||||||
if NearestProcNode<>nil then begin
|
if NearestProcNode<>nil then begin
|
||||||
SetIndentAndInsertPos(NearestProcNode,true);
|
SetIndentAndInsertPos(NearestProcNode,NearestProcNode.Desc<>ctnBeginBlock);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -6690,8 +6692,11 @@ var
|
|||||||
|
|
||||||
// Default position: Insert behind last node
|
// Default position: Insert behind last node
|
||||||
if (StartSearchProc<>nil)
|
if (StartSearchProc<>nil)
|
||||||
and (StartSearchProc.Parent<>nil) then
|
and (StartSearchProc.Parent<>nil) then begin
|
||||||
NearestProcNode:=StartSearchProc.Parent.LastChild;
|
NearestProcNode:=StartSearchProc.Parent.LastChild;
|
||||||
|
if NearestProcNode.Desc=ctnBeginBlock then
|
||||||
|
NearestProcNode:=NearestProcNode.PriorBrother;
|
||||||
|
end;
|
||||||
if NearestProcNode<>nil then begin
|
if NearestProcNode<>nil then begin
|
||||||
Indent:=0;
|
Indent:=0;
|
||||||
InsertPos:=FindLineEndOrCodeAfterPosition(NearestProcNode.EndPos);
|
InsertPos:=FindLineEndOrCodeAfterPosition(NearestProcNode.EndPos);
|
||||||
|
Loading…
Reference in New Issue
Block a user