Show quoted text 9 lines
> On May 7, 2020, at 5:26 PM, Mattias Gaertner via fpc-pascal
> wrote:
>
> Nodes are always associated with a Tool. Tool.MainFilename gives the
> file, where parsing started.
>
Just curious, can you explain the reasoning of "tools"? I haven't
exactly figured out the delegation of tasks in your system.
Maybe this helps:
https://wiki.freepascal.org/Codetools#Tool.2C_Node.2C_LinkScanner
Show quoted text 8 lines
>> I need this information so I can get navigate to the include file
>> AND relative text offset into the include file text.
>
> There are plenty of functions for include files. Can you give an
> example what you need?
I start with CodeToolBoss.Explore after loading the unit and get the
current tool from that. I need to start with an actual unit right?
Yes, if you need the higher level functions like FindDeclaration.
Of course there are lower level functions to parse snippets. See unit BasicCodetools.
Show quoted text 8 lines
don't think it will parse plain include files on its own, and that
won't often work anyways because there are macros in the unit which
includes the include file.
I'm collecting the symbols so that I can return them to the client
and it can navigate to a particular file at a line/column number. The
file which I navigate to must be the include file but I only have
those location relative to the unit, not the include.
Use Tool.CleanPosToCaret(Node.StartPos,xyp) to get the file, line and column.
Mattias
Mattias