Merged revision(s) 56360 #0e12730671 from trunk:

IDE: Show dotted unit names in Code Explorer. Issue #32663.
........

git-svn-id: branches/fixes_1_8@56421 -
This commit is contained in:
maxim 2017-11-16 22:37:44 +00:00
parent 467bbb952e
commit d3dfc5424b
2 changed files with 22 additions and 12 deletions

View File

@ -277,6 +277,7 @@ type
AnIdentifier: PChar): boolean; AnIdentifier: PChar): boolean;
function CompareSrcIdentifiersMethod(Identifier1, Identifier2: Pointer): integer; function CompareSrcIdentifiersMethod(Identifier1, Identifier2: Pointer): integer;
function ExtractIdentifier(CleanStartPos: integer): string; function ExtractIdentifier(CleanStartPos: integer): string;
function ExtractDottedIdentifier(CleanStartPos: integer): string;
procedure CreateChildNode; procedure CreateChildNode;
procedure EndChildNode; {$IFDEF UseInline}inline;{$ENDIF} procedure EndChildNode; {$IFDEF UseInline}inline;{$ENDIF}
@ -3040,6 +3041,11 @@ begin
Result:=''; Result:='';
end; end;
function TCustomCodeTool.ExtractDottedIdentifier(CleanStartPos: integer): string;
begin
Result:=GetDottedIdentifier(@Src[CleanStartPos]);
end;
procedure TCustomCodeTool.DoDeleteNodes(StartNode: TCodeTreeNode); procedure TCustomCodeTool.DoDeleteNodes(StartNode: TCodeTreeNode);
// delete Node and all following nodes // delete Node and all following nodes
var var

View File

@ -776,9 +776,15 @@ begin
ctnResStrSection: ctnResStrSection:
Result:='Resourcestring'; Result:='Resourcestring';
ctnVarDefinition,ctnConstDefinition,ctnUseUnit: ctnVarDefinition,
ctnConstDefinition,
ctnEnumIdentifier,
ctnLabel:
Result:=ACodeTool.ExtractIdentifier(CodeNode.StartPos); Result:=ACodeTool.ExtractIdentifier(CodeNode.StartPos);
ctnUseUnit:
Result:=ACodeTool.ExtractDottedIdentifier(CodeNode.StartPos);
ctnTypeDefinition: ctnTypeDefinition:
begin begin
Result:=ACodeTool.ExtractIdentifier(CodeNode.StartPos); Result:=ACodeTool.ExtractIdentifier(CodeNode.StartPos);
@ -804,9 +810,6 @@ begin
ctnClassInterface,ctnCPPClass: ctnClassInterface,ctnCPPClass:
Result:='('+ACodeTool.ExtractClassInheritance(CodeNode,[])+')'; Result:='('+ACodeTool.ExtractClassInheritance(CodeNode,[])+')';
ctnEnumIdentifier, ctnLabel:
Result:=ACodeTool.ExtractIdentifier(CodeNode.StartPos);
ctnProcedure: ctnProcedure:
Result:=ACodeTool.ExtractProcHead(CodeNode, Result:=ACodeTool.ExtractProcHead(CodeNode,
[// phpWithStart is no needed because there are icons [// phpWithStart is no needed because there are icons
@ -1090,11 +1093,9 @@ begin
//if NodeText='TCodeExplorerView' then //if NodeText='TCodeExplorerView' then
// debugln(['TCodeExplorerView.CreateIdentifierNodes CodeNode=',CodeNode.DescAsString,' NodeText="',NodeText,'" Category=',dbgs(Category),' InFrontViewNode=',InFrontViewNode<>nil,' CurParentViewNode=',CurParentViewNode<>nil]); // debugln(['TCodeExplorerView.CreateIdentifierNodes CodeNode=',CodeNode.DescAsString,' NodeText="',NodeText,'" Category=',dbgs(Category),' InFrontViewNode=',InFrontViewNode<>nil,' CurParentViewNode=',CurParentViewNode<>nil]);
if InFrontViewNode<>nil then if InFrontViewNode<>nil then
ViewNode:=CodeTreeview.Items.InsertObjectBehind( ViewNode:=CodeTreeview.Items.InsertObjectBehind(InFrontViewNode,NodeText,NodeData)
InFrontViewNode,NodeText,NodeData)
else if CurParentViewNode<>nil then else if CurParentViewNode<>nil then
ViewNode:=CodeTreeview.Items.AddChildObject( ViewNode:=CodeTreeview.Items.AddChildObject(CurParentViewNode,NodeText,NodeData)
CurParentViewNode,NodeText,NodeData)
else else
ViewNode:=CodeTreeview.Items.AddObject(nil,NodeText,NodeData); ViewNode:=CodeTreeview.Items.AddObject(nil,NodeText,NodeData);
ViewNode.ImageIndex:=NodeImageIndex; ViewNode.ImageIndex:=NodeImageIndex;
@ -2681,15 +2682,18 @@ begin
CurName:=''; CurName:='';
case CodeNode.Desc of case CodeNode.Desc of
ctnTypeDefinition,ctnVarDefinition,ctnConstDefinition,ctnUseUnit: ctnTypeDefinition,
ctnVarDefinition,
ctnConstDefinition,
ctnEnumIdentifier:
CurName:=ACodeTool.ExtractIdentifier(CodeNode.StartPos); CurName:=ACodeTool.ExtractIdentifier(CodeNode.StartPos);
ctnUseUnit:
CurName:=ACodeTool.ExtractDottedIdentifier(CodeNode.StartPos);
ctnGenericType: ctnGenericType:
CurName:=ACodeTool.ExtractDefinitionName(CodeNode); CurName:=ACodeTool.ExtractDefinitionName(CodeNode);
ctnEnumIdentifier:
CurName:=ACodeTool.ExtractIdentifier(CodeNode.StartPos);
ctnProcedure: ctnProcedure:
CurName:=ACodeTool.ExtractProcName(CodeNode,[]); CurName:=ACodeTool.ExtractProcName(CodeNode,[]);