Code tools unrelated completions

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Code tools unrelated completions

Free Pascal - General mailing list
Code tools completions are returning functions that don't appear related to the current unit such as "fpc_Copy" from /usr/local/share/fpcsrc/rtl/inc/compproc.inc.

Here's a snippet of the code I use to get identifiers.

      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];



Is this normal to be getting these results? I'd like to not have them if possible.

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Code tools unrelated completions

Michael Van Canneyt


On Tue, 5 May 2020, Ryan Joseph via fpc-pascal wrote:

> Code tools completions are returning functions that don't appear related to the current unit such as "fpc_Copy" from /usr/local/share/fpcsrc/rtl/inc/compproc.inc.
>
> Here's a snippet of the code I use to get identifiers.
>
>      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];
>
>
>
> Is this normal to be getting these results? I'd like to not have them if possible.

They are in the system unit, so they're always related to any unit.

They have a compilerproc modifier set, so I suppose there is some
property/attribute of the identifier that indicates this modifier.
You should check for that and filter out these results.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Code tools unrelated completions

Free Pascal - General mailing list


> On May 5, 2020, at 3:56 PM, Michael Van Canneyt <[hidden email]> wrote:
>
> They are in the system unit, so they're always related to any unit.
>
> They have a compilerproc modifier set, so I suppose there is some
> property/attribute of the identifier that indicates this modifier.
> You should check for that and filter out these results.

AFAIK they are not meant to be called by users so I'd like to filter them out.

how do we get function modifiers for TIdentifierListItem then?

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Code tools unrelated completions

Michael Van Canneyt


On Tue, 5 May 2020, Ryan Joseph via fpc-pascal wrote:

>
>
>> On May 5, 2020, at 3:56 PM, Michael Van Canneyt <[hidden email]> wrote:
>>
>> They are in the system unit, so they're always related to any unit.
>>
>> They have a compilerproc modifier set, so I suppose there is some
>> property/attribute of the identifier that indicates this modifier.
>> You should check for that and filter out these results.
>
> AFAIK they are not meant to be called by users so I'd like to filter them out.
>
> how do we get function modifiers for TIdentifierListItem then?

I have no idea. This is a question for Mattias.

But looking at PascalParserTool.pas, line 1988 I think I may have been too
optimistic;

    end else if UpAtomIs('COMPILERPROC') then begin
       ReadNextAtom;
       if CurPos.Flag=cafColon then begin
         // e.g. compilerproc:fpc_in_delete_x_y_z;
         ReadNextAtom;
         AtomIsIdentifierSaveE(20180411194104);
         ReadNextAtom;
       end;

it's handled but not recorded.


Michael.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Code tools unrelated completions

Free Pascal - General mailing list
On Tue, 5 May 2020 11:19:34 +0200 (CEST)
Michael Van Canneyt <[hidden email]> wrote:

> On Tue, 5 May 2020, Ryan Joseph via fpc-pascal wrote:
>
> >
> >  
> >> On May 5, 2020, at 3:56 PM, Michael Van Canneyt
> >> <[hidden email]> wrote:
> >>
> >> They are in the system unit, so they're always related to any unit.
> >>
> >> They have a compilerproc modifier set, so I suppose there is some
> >> property/attribute of the identifier that indicates this modifier.
> >> You should check for that and filter out these results.  
> >
> > AFAIK they are not meant to be called by users so I'd like to
> > filter them out.
> >
> > how do we get function modifiers for TIdentifierListItem then?  
>
> I have no idea. This is a question for Mattias.
>
> But looking at PascalParserTool.pas, line 1988 I think I may have
> been too optimistic;
>
>     end else if UpAtomIs('COMPILERPROC') then begin
>        ReadNextAtom;
>        if CurPos.Flag=cafColon then begin
>          // e.g. compilerproc:fpc_in_delete_x_y_z;
>          ReadNextAtom;
>          AtomIsIdentifierSaveE(20180411194104);
>          ReadNextAtom;
>        end;
>
> it's handled but not recorded.

Yes, recording is a todo.
If you want to check this you have to use the parsing functions like
ProcNodeHasSpecifier or MoveCursorToProcSpecifier.

Mattias



Mattias
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Code tools unrelated completions

Free Pascal - General mailing list


> On May 5, 2020, at 4:35 PM, Mattias Gaertner via fpc-pascal <[hidden email]> wrote:
>
> Yes, recording is a todo.
> If you want to check this you have to use the parsing functions like
> ProcNodeHasSpecifier or MoveCursorToProcSpecifier.

Why don't the nodes keep track of this information btw? That was the first place I got confused by since I expected them to have lots of meta data along with them.

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal