Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2020-07

CodeTools reduce number of completions

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ryan Joseph

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

Reply by email

Mattias Gaertner
to Ryan Joseph
Show quoted text 7 lines
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

Reply by email

Ryan Joseph
to Mattias Gaertner
Show quoted text 8 lines
On Jul 2, 2020, at 2:04 AM, Mattias Gaertner via fpc-pascal 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

Reply by email

Ryan Joseph
to Ryan Joseph
On Jul 2, 2020, at 8:05 AM, Ryan Joseph 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

Reply by email

Mattias Gaertner
to Ryan Joseph
[...]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.Toolnil) 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

Reply by email

Ryan Joseph
to Mattias Gaertner
Show quoted text 17 lines
On Jul 2, 2020, at 4:04 PM, Mattias Gaertner via fpc-pascal wrote: Maybe something like this: List:=CodeToolBoss.IdentifierList; for i:=0 to List.GetFilteredCountCnt-1 do begin Item:=List.FilteredItems[i]; if (Item.Toolnil) 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

Reply by email