mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 15:59:13 +02:00
code completion, local var completion now indents correct after var a:b;
git-svn-id: trunk@3150 -
This commit is contained in:
parent
e231ac6cbf
commit
7eefc30745
@ -34,6 +34,7 @@
|
||||
- complete local variables
|
||||
|
||||
ToDo:
|
||||
-add missing method definitions
|
||||
-ProcExists: search procs in ancestors too
|
||||
-VarExists: search vars in ancestors too
|
||||
}
|
||||
@ -529,8 +530,6 @@ begin
|
||||
+'CleanPosToCodePos');
|
||||
end;
|
||||
|
||||
//writeln('TCodeCompletionCodeTool.AddLocalVariable A2 ',CursorNode<>nil);
|
||||
|
||||
// find parent block node at cursor
|
||||
BeginNode:=CursorNode.GetNodeOfType(ctnBeginBlock);
|
||||
if (BeginNode=nil) or (BeginNode.Parent=nil) then begin
|
||||
@ -538,8 +537,6 @@ begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
//writeln('TCodeCompletionCodeTool.AddLocalVariable C ');
|
||||
|
||||
// find last 'var' section node
|
||||
VarSectionNode:=BeginNode;
|
||||
while (VarSectionNode<>nil) and (VarSectionNode.Desc<>ctnVarSection) do
|
||||
@ -552,10 +549,12 @@ begin
|
||||
// there is already a var section
|
||||
// -> append variable
|
||||
VarNode:=VarSectionNode.FirstChild;
|
||||
Indent:=GetLineIndent(Src,VarNode.StartPos);
|
||||
// search last variable in var section
|
||||
while (VarNode.NextBrother<>nil) do
|
||||
VarNode:=VarNode.NextBrother;
|
||||
Indent:=GetLineIndent(Src,VarNode.StartPos);
|
||||
if PositionsInSameLine(Src,VarSectionNode.StartPos,VarNode.StartPos) then
|
||||
inc(Indent,SourceChangeCache.BeautifyCodeOptions.Indent);
|
||||
InsertPos:=FindLineEndOrCodeAfterPosition(VarNode.EndPos);
|
||||
end else begin
|
||||
// there is no var section yet
|
||||
|
Loading…
Reference in New Issue
Block a user