[fpc-pascal] Pascal Language Server

Mattias Gaertner nc-gaertnma at netcologne.de
Fri May 1 13:01:56 CEST 2020


On Wed, 29 Apr 2020 21:18:02 +0700
Ryan Joseph via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:

> Testing this more I'm having a problem getting overwhelmed by
> completions for classes because of methods from TObject (and other
> parents)

The RTL is powerful.
That's why I prefer to put recently used identifiers at top of the
completion box.


> so I'd like to add some information about this.
> 
> Using this method:
> 
>     if CodeToolBoss.GatherIdentifiers(Code,X + 1,Y + 1) then
>     begin
>       Count := CodeToolBoss.IdentifierList.GetFilteredCount;
>       for I := 0 to Count - 1 do
>       begin
>         Identifier := CodeToolBoss.IdentifierList.FilteredItems[I];
> 
> 
> can I find the parent class of "Identifier"(TIdentifierListItem)?
> There's a TCodeTreeNode field that maybe I could walk up to find what
> I need?

Sure.
Something like:
while Node<>nil do begin
  if (Node.Desc=ctnClass) then begin
    if Tool.ExtractClassName(Node),false)='TObject' then ...
    break;
  end else
    Node:=Node.Parent;
end;

Mattias


More information about the fpc-pascal mailing list