Skip to content

Commit

Permalink
ignore symbols from include files
Browse files Browse the repository at this point in the history
  • Loading branch information
genericptr committed Jul 9, 2020
1 parent 3184285 commit 7e0183d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion documentSymbol.pas
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface

uses
Classes, Contnrs, URIParser, fpjson, fpjsonrpc, SQLite3,
CodeToolManager, CodeCache, CodeTree,
CodeToolManager, CodeCache, CodeTree, LinkScanner,
lsp, basic, codeUtils;

type
Expand Down Expand Up @@ -753,11 +753,22 @@ procedure TSymbolExtractor.ExtractCodeSection(Node: TCodeTreeNode);
var
Symbol: TSymbol = nil;
Child: TCodeTreeNode;
Scanner: TLinkScanner;
LinkIndex: Integer;
begin
while Node <> nil do
begin
PrintNodeDebug(Node);

// ignore nodes from include files
Scanner := Tool.Scanner;
LinkIndex := Scanner.LinkIndexAtCleanPos(Node.StartPos);
if (LinkIndex >= 0) and (Scanner.LinkP[LinkIndex]^.Code<>Scanner.MainCode) then
begin
Node := Node.NextBrother;
continue;
end;

// recurse into code sections
if (Node.Desc in AllCodeSections) and (Node.ChildCount > 0) then
begin
Expand Down

0 comments on commit 7e0183d

Please sign in to comment.