CodeTools reduce number of completions

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

CodeTools reduce number of completions

Free Pascal - General mailing list
I'm using CodeToolBoss.GatherIdentifiers to get completions but with some units I'm getting 50k identifiers which is simply too much and too slow. Maybe of these are coming from the RTL I think and I would be ok with limited some of these results if possible.

Is there anyway to tell CodeTools to ignore certain units or any other way to reduce the number of results? One option would be return results in partial batches (Language Server Protocol) supports this but again I'm not sure if CodeTools supports this or not.

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: CodeTools reduce number of completions

Free Pascal - General mailing list
On Wed, 1 Jul 2020 17:50:50 +0700
Ryan Joseph via fpc-pascal <[hidden email]> wrote:

> I'm using CodeToolBoss.GatherIdentifiers to get completions but with
> some units I'm getting 50k identifiers which is simply too much and
> too slow. Maybe of these are coming from the RTL I think and I would
> be ok with limited some of these results if possible.
>
> Is there anyway to tell CodeTools to ignore certain units or any
> other way to reduce the number of results?

So far only the prefix.

> One option would be return
> results in partial batches (Language Server Protocol) supports this
> but again I'm not sure if CodeTools supports this or not.

Codetools provide a list of identifiers. Since you loop over the list
to fetch the identifiers, why not apply any filter you like directly?

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: CodeTools reduce number of completions

Free Pascal - General mailing list


> On Jul 2, 2020, at 2:04 AM, Mattias Gaertner via fpc-pascal <[hidden email]> wrote:
>
>> One option would be return
>> results in partial batches (Language Server Protocol) supports this
>> but again I'm not sure if CodeTools supports this or not.
>
> Codetools provide a list of identifiers. Since you loop over the list
> to fetch the identifiers, why not apply any filter you like directly?

The majority of the work takes place in GatherIdentifiers. This is because MacOSAll and CocoaAll units. They're just massive files so I'm not sure what we can do about them.

Maybe can we make an extension which ignores some arbitrary number of units? I can survive without completing things in MacOSAll because the alternative is slow typing and potential stuttering. I would try to remove FPCDIR and /usr/local/share/fpcsrc to ignore the RTL also but then I get syntax errors in CodeTools which prevents it from searching files. Ignoring those errors would be another possible solution.

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: CodeTools reduce number of completions

Free Pascal - General mailing list


> On Jul 2, 2020, at 8:05 AM, Ryan Joseph <[hidden email]> wrote:
>
> The majority of the work takes place in GatherIdentifiers. This is because MacOSAll and CocoaAll units. They're just massive files so I'm not sure what we can do about them.

I think I was wrong about this being the root of the problem actually. What would be more helpful is knowing which identifiers are from those large units and opting out of additional processing. Is that something which can be quickly known?

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: CodeTools reduce number of completions

Free Pascal - General mailing list
On Thu, 2 Jul 2020 12:55:24 +0700
Ryan Joseph via fpc-pascal <[hidden email]> wrote:

>[...]What would be more helpful is knowing which identifiers are
> from those large units and opting out of additional processing. Is
> that something which can be quickly known?

Maybe something like this:

List:=CodeToolBoss.IdentifierList;
for i:=0 to List.GetFilteredCountCnt-1 do
begin
  Item:=List.FilteredItems[i];
  if (Item.Tool<>nil) then begin
    if
    RightStr(Item.Tool.MainFilename,33)='packages/univint/src/MacOSAll.pas'
    then continue;

    if Item.Tool.Scanner.CleanedLen>1000000 then
      continue;
  end;
end;

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: CodeTools reduce number of completions

Free Pascal - General mailing list


> On Jul 2, 2020, at 4:04 PM, Mattias Gaertner via fpc-pascal <[hidden email]> wrote:
>
> Maybe something like this:
>
> List:=CodeToolBoss.IdentifierList;
> for i:=0 to List.GetFilteredCountCnt-1 do
> begin
>  Item:=List.FilteredItems[i];
>  if (Item.Tool<>nil) then begin
>    if
>    RightStr(Item.Tool.MainFilename,33)='packages/univint/src/MacOSAll.pas'
>    then continue;
>
>    if Item.Tool.Scanner.CleanedLen>1000000 then
>      continue;
>  end;
> end;

Item.Tool.MainFilename is helpful to know, thanks.

Btw, since I have your attention, any idea about that FindReferences bug I reported some days? Still haven't figured it out yet.

Regards,
        Ryan Joseph

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