codetools: fixed code completion in sub begin block

git-svn-id: trunk@19527 -
This commit is contained in:
mattias 2009-04-20 16:08:30 +00:00
parent 77bcda84a7
commit 39701eb2d7

View File

@ -855,6 +855,7 @@ var
Indent, InsertPos: integer;
InsertTxt: string;
OldCodePos: TCodePosition;
Node: TCodeTreeNode;
begin
//DebugLn('TCodeCompletionCodeTool.AddLocalVariable A ');
Result:=false;
@ -865,7 +866,13 @@ begin
end;
// find parent block node at cursor
BeginNode:=CursorNode.GetNodeOfType(ctnBeginBlock);
BeginNode:=nil;
Node:=CursorNode;
while Node<>nil do begin
if Node.Desc=ctnBeginBlock then
BeginNode:=Node;
Node:=Node.Parent;
end;
if (BeginNode=nil) or (BeginNode.Parent=nil) then begin
DebugLn('TCodeCompletionCodeTool.AddLocalVariable - Not in Begin Block');
exit;