mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 14:19:42 +02:00
codetools: fixed TCodeCompletionCodeTool.DeclareVariableNearBy class members
git-svn-id: trunk@31275 -
This commit is contained in:
parent
93a6c5de7b
commit
9fb8ba331a
@ -5500,16 +5500,18 @@ var
|
||||
begin
|
||||
Result:=false;
|
||||
{$IFDEF CTDEBUG}
|
||||
debugln(['TCodeCompletionCodeTool.DeclareVariableNearBy InsertPos=',dbgs(InsertPos),' Name="',VariableName,'" Type="',NewType,'" Unit=',NewUnitName]);
|
||||
debugln(['TCodeCompletionCodeTool.DeclareVariableNearBy InsertPos=',dbgs(InsertPos),' Name="',VariableName,'" Type="',NewType,'" Unit=',NewUnitName,' LevelPos=',dbgs(LevelPos)]);
|
||||
{$ENDIF}
|
||||
BuildTreeAndGetCleanPos(InsertPos,CleanCursorPos);
|
||||
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
|
||||
CaretToCleanPos(LevelPos,LevelCleanPos);
|
||||
SourceChangeCache.MainScanner:=Scanner;
|
||||
Node:=CursorNode;
|
||||
if LevelCleanPos>0 then begin
|
||||
Node:=FindDeepestNodeAtPos(LevelCleanPos,false);
|
||||
while Node<>nil do begin
|
||||
//debugln(['TCodeCompletionCodeTool.DeclareVariableNearBy Node=',Node.DescAsString]);
|
||||
if Node.Desc in AllClassObjects then begin
|
||||
// class member
|
||||
debugln(['TCodeCompletionCodeTool.DeclareVariableNearBy class member']);
|
||||
// initialize class for code completion
|
||||
InitClassCompletion(Node,SourceChangeCache);
|
||||
// check if variable already exists
|
||||
@ -5540,6 +5542,9 @@ begin
|
||||
end;
|
||||
Node:=Node.Parent;
|
||||
end;
|
||||
end;
|
||||
SourceChangeCache.MainScanner:=Scanner;
|
||||
Node:=CursorNode;
|
||||
Result:=AddLocalVariable(CleanCursorPos,1,VariableName,NewType,NewUnitName,
|
||||
NewPos,NewTopLine,SourceChangeCache,LevelCleanPos);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user