mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 13:59:20 +02:00
codetools: identifier completion: list used units
git-svn-id: trunk@24999 -
This commit is contained in:
parent
ca57327310
commit
e9d4b90835
@ -3300,7 +3300,7 @@ begin
|
||||
if (CompilerPath='') or (not FileIsExecutable(CompilerPath)) then exit;
|
||||
LastDefTempl:=nil;
|
||||
// find all initial compiler macros and all unit paths
|
||||
// -> ask compiler with the -vm -vt switch
|
||||
// -> ask compiler with the -va switch
|
||||
SetLength(Buf,1024);
|
||||
Step:='Init';
|
||||
try
|
||||
|
@ -5284,25 +5284,38 @@ var
|
||||
NewCodeTool: TFindDeclarationTool;
|
||||
OldFlags: TFindDeclarationFlags;
|
||||
Node: TCodeTreeNode;
|
||||
CollectResult: TIdentifierFoundResult;
|
||||
begin
|
||||
{$IFDEF CheckNodeTool}CheckNodeTool(UsesNode);{$ENDIF}
|
||||
{$IFDEF ShowTriedParentContexts}
|
||||
DebugLn(['TFindDeclarationTool.FindIdentifierInUsesSection ',MainFilename,' fdfIgnoreUsedUnits=',fdfIgnoreUsedUnits in Params.Flags]);
|
||||
{$ENDIF}
|
||||
Result:=false;
|
||||
// first search in used unit names
|
||||
if (Params.IdentifierTool=Self) then begin
|
||||
Node:=UsesNode.LastChild;
|
||||
while Node<>nil do begin
|
||||
if CompareSrcIdentifiers(Node.StartPos,Params.Identifier) then begin
|
||||
if (fdfCollect in Params.Flags) then begin
|
||||
CollectResult:=DoOnIdentifierFound(Params,Node);
|
||||
if CollectResult=ifrAbortSearch then begin
|
||||
Result:=false;
|
||||
exit;
|
||||
end else if CollectResult=ifrSuccess then begin
|
||||
Result:=true;
|
||||
Params.SetResult(Self,Node);
|
||||
exit;
|
||||
end;
|
||||
end else if CompareSrcIdentifiers(Node.StartPos,Params.Identifier) then begin
|
||||
// the searched identifier was a uses AUnitName, point to the identifier in
|
||||
// the uses section
|
||||
Result:=true;
|
||||
Params.SetResult(Self,Node,Node.StartPos);
|
||||
Result:=true;
|
||||
exit;
|
||||
end;
|
||||
Node:=Node.PriorBrother;
|
||||
end;
|
||||
end;
|
||||
|
||||
if not (fdfIgnoreUsedUnits in Params.Flags) then begin
|
||||
// search in units
|
||||
Node:=UsesNode.LastChild;
|
||||
|
@ -173,7 +173,7 @@ type
|
||||
ilcfStartIsSubIdent, // atom in front is point
|
||||
ilcfNeedsEndSemicolon, // after context a semicolon is needed. e.g. 'A| end'
|
||||
ilcfNoEndSemicolon, // no semicolon after. E.g. 'A| else'
|
||||
ilcfNeedsEndComma, // after context a comma is needed. e.g. 'sysutil| classes'
|
||||
ilcfNeedsEndComma, // after context a comma is needed. e.g. 'uses sysutil| classes'
|
||||
ilcfIsExpression, // is expression part of statement. e.g. 'if expr'
|
||||
ilcfCanProcDeclaration,// context allows to declare a procedure/method
|
||||
ilcfEndOfLine // atom at end of line
|
||||
@ -1058,6 +1058,10 @@ begin
|
||||
ctnRecordCase:
|
||||
Ident:=@FoundContext.Tool.Src[Params.NewCleanPos];
|
||||
|
||||
ctnUseUnit:
|
||||
if (FoundContext.Tool=Self) then begin
|
||||
Ident:=@Src[FoundContext.Node.StartPos];
|
||||
end;
|
||||
end;
|
||||
if Ident=nil then exit;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user