mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-26 16:33:46 +02:00
identifier completion now shows enums
git-svn-id: trunk@7566 -
This commit is contained in:
parent
0c8bf07ec3
commit
1f63c9f2f7
@ -2190,7 +2190,8 @@ var
|
||||
// identifier found
|
||||
Params.SetResult(Self,ContextNode);
|
||||
Result:=CheckResult(true,true);
|
||||
exit;
|
||||
if not (fdfCollect in Params.Flags) then
|
||||
exit;
|
||||
end;
|
||||
// search for enums
|
||||
Params.ContextNode:=ContextNode;
|
||||
@ -2589,35 +2590,45 @@ function TFindDeclarationTool.FindEnumInContext(
|
||||
true, if enum found
|
||||
}
|
||||
var OldContextNode, CurContextNode: TCodeTreeNode;
|
||||
CollectResult: TIdentifierFoundResult;
|
||||
begin
|
||||
Result:=false;
|
||||
if Params.ContextNode=nil then exit;
|
||||
OldContextNode:=Params.ContextNode;
|
||||
CurContextNode:=OldContextNode;
|
||||
CurContextNode:=Params.ContextNode;
|
||||
if CurContextNode.Desc=ctnClass then
|
||||
BuildSubTreeForClass(CurContextNode);
|
||||
CurContextNode:=CurContextNode.FirstChild;
|
||||
while CurContextNode<>nil do begin
|
||||
if (CurContextNode.Desc in [ctnEnumIdentifier])
|
||||
and ((fdfCollect in Params.Flags)
|
||||
or CompareSrcIdentifiers(CurContextNode.StartPos,Params.Identifier))
|
||||
then begin
|
||||
// identifier found
|
||||
|
||||
// ToDo: fdfCollect
|
||||
|
||||
Result:=true;
|
||||
Params.SetResult(Self,CurContextNode);
|
||||
exit;
|
||||
if (CurContextNode.Desc=ctnEnumIdentifier) then begin
|
||||
if (fdfCollect in Params.Flags) then begin
|
||||
//debugln('TFindDeclarationTool.FindEnumInContext ',GetIdentifier(@Src[CurContextNode.StartPos]));
|
||||
CollectResult:=DoOnIdentifierFound(Params,CurContextNode);
|
||||
if CollectResult=ifrAbortSearch then begin
|
||||
Result:=false;
|
||||
exit;
|
||||
end else if CollectResult=ifrSuccess then begin
|
||||
Result:=true;
|
||||
Params.SetResult(Self,CurContextNode);
|
||||
exit;
|
||||
end;
|
||||
end else if CompareSrcIdentifiers(CurContextNode.StartPos,Params.Identifier)
|
||||
then begin
|
||||
// identifier found
|
||||
Result:=true;
|
||||
Params.SetResult(Self,CurContextNode);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
OldContextNode:=Params.ContextNode;
|
||||
try
|
||||
Params.ContextNode:=CurContextNode;
|
||||
Result:=FindEnumInContext(Params);
|
||||
finally
|
||||
Params.ContextNode:=OldContextNode;
|
||||
if OldContextNode.FirstChild<>nil then begin
|
||||
try
|
||||
Params.ContextNode:=CurContextNode;
|
||||
Result:=FindEnumInContext(Params);
|
||||
finally
|
||||
Params.ContextNode:=OldContextNode;
|
||||
end;
|
||||
if Result then exit;
|
||||
end;
|
||||
if Result then exit;
|
||||
CurContextNode:=CurContextNode.NextBrother;
|
||||
end;
|
||||
end;
|
||||
@ -6242,9 +6253,6 @@ function TFindDeclarationTool.DoOnIdentifierFound(
|
||||
// this internal function is called, whenever an identifier is found
|
||||
var IsTopLvlIdent: boolean;
|
||||
begin
|
||||
|
||||
// ToDo: check if identifier is in a forbidden class visibility section
|
||||
|
||||
IsTopLvlIdent:=(fdfTopLvlResolving in Params.Flags);
|
||||
if Assigned(Params.OnIdentifierFound) then
|
||||
Result:=Params.OnIdentifierFound(Params,CreateFindContext(Self,FoundNode))
|
||||
|
@ -656,7 +656,7 @@ begin
|
||||
{$IFDEF ShowFoundIdents}
|
||||
DebugLn('::: COLLECT IDENT ',FoundContext.Node.DescAsString,
|
||||
' "',StringToPascalConst(copy(FoundContext.Tool.Src,FoundContext.Node.StartPos,50)),'"'
|
||||
,' ',fdfIgnoreUsedUnits in Params.Flags);
|
||||
,' '+dbgs(fdfIgnoreUsedUnits in Params.Flags));
|
||||
{$ENDIF}
|
||||
|
||||
CurContextParent:=FoundContext.Node.GetFindContextParent;
|
||||
@ -666,7 +666,12 @@ begin
|
||||
inc(LastGatheredIdentLevel);
|
||||
end;
|
||||
|
||||
if FoundContext.Tool<>Self then begin
|
||||
if FoundContext.Tool=Self then begin
|
||||
// identifier is in the same unit
|
||||
//DebugLn('::: COLLECT IDENT in SELF ',FoundContext.Node.DescAsString,
|
||||
// ' "',StringToPascalConst(copy(FoundContext.Tool.Src,FoundContext.Node.StartPos,50)),'"'
|
||||
// ,' '+dbgs(fdfIgnoreUsedUnits in Params.Flags));
|
||||
end else begin
|
||||
// identifier is in another unit
|
||||
if (FoundContext.Node.Parent<>nil) then begin
|
||||
if (FoundContext.Node.Parent.Desc=ctnClassPrivate) then begin
|
||||
|
@ -3921,6 +3921,7 @@ begin
|
||||
ObjectInspector1.EventGrid.ItemIndex:=-1;
|
||||
ObjectInspector1.FavouriteGrid.ItemIndex:=-1;
|
||||
end;
|
||||
debugln('TMainIDE.DoRemoveDanglingEvents ',AnUnitInfo.Filename,' ',dbgsName(AnUnitInfo.Component));
|
||||
// remove dangling methods
|
||||
Result:=RemoveDanglingEvents(AnUnitInfo.Component,AnUnitInfo.Source,true,
|
||||
ComponentModified);
|
||||
|
@ -143,7 +143,7 @@ begin
|
||||
s:='var';
|
||||
end;
|
||||
|
||||
ctnTypeDefinition:
|
||||
ctnTypeDefinition, ctnEnumerationType:
|
||||
begin
|
||||
AColor:=clDkGray;
|
||||
s:='type';
|
||||
@ -154,7 +154,7 @@ begin
|
||||
AColor:=clOlive;
|
||||
s:='const';
|
||||
end;
|
||||
|
||||
|
||||
ctnProcedure:
|
||||
if (IdentItem.Node<>nil)
|
||||
and IdentItem.Tool.NodeIsFunction(IdentItem.Node) then begin
|
||||
@ -170,6 +170,12 @@ begin
|
||||
AColor:=clPurple;
|
||||
s:='property';
|
||||
end;
|
||||
|
||||
ctnEnumIdentifier:
|
||||
begin
|
||||
AColor:=clOlive;
|
||||
s:='enum';
|
||||
end;
|
||||
|
||||
else
|
||||
AColor:=clGray;
|
||||
|
Loading…
Reference in New Issue
Block a user