code completion, local var completion now indents correct after var a:b;

git-svn-id: trunk@3150 -
This commit is contained in:
mattias 2002-08-18 16:50:02 +00:00
parent e231ac6cbf
commit 7eefc30745

View File

@ -34,6 +34,7 @@
- complete local variables - complete local variables
ToDo: ToDo:
-add missing method definitions
-ProcExists: search procs in ancestors too -ProcExists: search procs in ancestors too
-VarExists: search vars in ancestors too -VarExists: search vars in ancestors too
} }
@ -529,8 +530,6 @@ begin
+'CleanPosToCodePos'); +'CleanPosToCodePos');
end; end;
//writeln('TCodeCompletionCodeTool.AddLocalVariable A2 ',CursorNode<>nil);
// find parent block node at cursor // find parent block node at cursor
BeginNode:=CursorNode.GetNodeOfType(ctnBeginBlock); BeginNode:=CursorNode.GetNodeOfType(ctnBeginBlock);
if (BeginNode=nil) or (BeginNode.Parent=nil) then begin if (BeginNode=nil) or (BeginNode.Parent=nil) then begin
@ -538,8 +537,6 @@ begin
exit; exit;
end; end;
//writeln('TCodeCompletionCodeTool.AddLocalVariable C ');
// find last 'var' section node // find last 'var' section node
VarSectionNode:=BeginNode; VarSectionNode:=BeginNode;
while (VarSectionNode<>nil) and (VarSectionNode.Desc<>ctnVarSection) do while (VarSectionNode<>nil) and (VarSectionNode.Desc<>ctnVarSection) do
@ -552,10 +549,12 @@ begin
// there is already a var section // there is already a var section
// -> append variable // -> append variable
VarNode:=VarSectionNode.FirstChild; VarNode:=VarSectionNode.FirstChild;
Indent:=GetLineIndent(Src,VarNode.StartPos);
// search last variable in var section // search last variable in var section
while (VarNode.NextBrother<>nil) do while (VarNode.NextBrother<>nil) do
VarNode:=VarNode.NextBrother; 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); InsertPos:=FindLineEndOrCodeAfterPosition(VarNode.EndPos);
end else begin end else begin
// there is no var section yet // there is no var section yet