mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-26 15:49:10 +02:00
codetools: param completion: skip comments
git-svn-id: trunk@34866 -
This commit is contained in:
parent
deb1eafd12
commit
c7c01c9ffd
@ -1990,7 +1990,7 @@ function TCodeCompletionCodeTool.CompleteLocalIdentifierByParameter(
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
VarNameAtom, ProcNameAtom: TAtomPosition;
|
VarNameRange, ProcNameAtom: TAtomPosition;
|
||||||
ParameterIndex: integer;
|
ParameterIndex: integer;
|
||||||
Params: TFindDeclarationParams;
|
Params: TFindDeclarationParams;
|
||||||
ParameterNode: TCodeTreeNode;
|
ParameterNode: TCodeTreeNode;
|
||||||
@ -2022,17 +2022,19 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
// check parameter syntax
|
// check parameter syntax
|
||||||
if not CheckParameterSyntax(CursorNode,CleanCursorPos,
|
if not CheckParameterSyntax(CursorNode,CleanCursorPos,
|
||||||
VarNameAtom,ProcNameAtom,ParameterIndex)
|
VarNameRange,ProcNameAtom,ParameterIndex)
|
||||||
then
|
then
|
||||||
exit;
|
exit;
|
||||||
HasAtOperator:=false;
|
HasAtOperator:=false;
|
||||||
if (VarNameAtom.StartPos<=SrcLen)
|
if (VarNameRange.StartPos<=SrcLen)
|
||||||
and (Src[VarNameAtom.StartPos]='@') then begin
|
and (Src[VarNameRange.StartPos]='@') then begin
|
||||||
HasAtOperator:=true;
|
HasAtOperator:=true;
|
||||||
inc(VarNameAtom.StartPos);
|
MoveCursorToCleanPos(VarNameRange.StartPos+1);
|
||||||
//debugln(['TCodeCompletionCodeTool.CompleteLocalIdentifierByParameter HasAtOperator ',GetAtom(VarNameAtom)]);
|
ReadNextAtom;
|
||||||
|
VarNameRange.StartPos:=CurPos.StartPos;
|
||||||
|
//debugln(['TCodeCompletionCodeTool.CompleteLocalIdentifierByParameter HasAtOperator ',GetAtom(VarNameRange)]);
|
||||||
end;
|
end;
|
||||||
Identifier:=GetAtom(VarNameAtom);
|
Identifier:=ExtractCode(VarNameRange.StartPos,VarNameRange.EndPos,[]);
|
||||||
if not IsValidIdent(Identifier) then exit;
|
if not IsValidIdent(Identifier) then exit;
|
||||||
|
|
||||||
{$IFDEF CTDEBUG}
|
{$IFDEF CTDEBUG}
|
||||||
@ -2046,9 +2048,9 @@ begin
|
|||||||
DebugLn(' CompleteLocalIdentifierByParameter: check if variable is already defined ...');
|
DebugLn(' CompleteLocalIdentifierByParameter: check if variable is already defined ...');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
// check if identifier exists
|
// check if identifier exists
|
||||||
Result:=IdentifierIsDefined(VarNameAtom,CursorNode,Params);
|
Result:=IdentifierIsDefined(VarNameRange,CursorNode,Params);
|
||||||
if Result then begin
|
if Result then begin
|
||||||
MoveCursorToCleanPos(VarNameAtom.StartPos);
|
MoveCursorToCleanPos(VarNameRange.StartPos);
|
||||||
ReadNextAtom;
|
ReadNextAtom;
|
||||||
RaiseExceptionFmt(ctsIdentifierAlreadyDefined,[GetAtom]);
|
RaiseExceptionFmt(ctsIdentifierAlreadyDefined,[GetAtom]);
|
||||||
end;
|
end;
|
||||||
@ -2092,7 +2094,7 @@ begin
|
|||||||
Params.Flags:=Params.Flags+[fdfSearchInParentNodes,fdfIgnoreCurContextNode]
|
Params.Flags:=Params.Flags+[fdfSearchInParentNodes,fdfIgnoreCurContextNode]
|
||||||
else
|
else
|
||||||
Params.Flags:=Params.Flags-[fdfSearchInParentNodes,fdfIgnoreCurContextNode];
|
Params.Flags:=Params.Flags-[fdfSearchInParentNodes,fdfIgnoreCurContextNode];
|
||||||
CleanPosToCodePos(VarNameAtom.StartPos,IgnorePos);
|
CleanPosToCodePos(VarNameRange.StartPos,IgnorePos);
|
||||||
IgnoreErrorAfter:=IgnorePos;
|
IgnoreErrorAfter:=IgnorePos;
|
||||||
try
|
try
|
||||||
{$IFDEF CTDEBUG}
|
{$IFDEF CTDEBUG}
|
||||||
@ -2191,7 +2193,7 @@ begin
|
|||||||
Params.Free;
|
Params.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Result:=AddLocalVariable(CleanCursorPos,OldTopLine,GetAtom(VarNameAtom),
|
Result:=AddLocalVariable(CleanCursorPos,OldTopLine,GetAtom(VarNameRange),
|
||||||
NewType,MissingUnitName,NewPos,NewTopLine,SourceChangeCache);
|
NewType,MissingUnitName,NewPos,NewTopLine,SourceChangeCache);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user