insert-unicode icon indicating copy to clipboard operation
insert-unicode copied to clipboard

Use Fuzzy Search?

Open JP-Ellis opened this issue 4 years ago • 7 comments

It would be good if the search was 'fuzzy', or at least less restrictive.

For example, I would expect that the search for greek beta would give all results which have both greek and beta in their description; however, the extension only returns matches which contain greek beta as an exact substring.

I realize that it's possible to use greek*beta which is a partial solution, it is still sensitive to the order of words (for example, beta*greek returns no result).

JP-Ellis avatar Feb 12 '20 02:02 JP-Ellis

That would be quite useful, but the extension has to rely on the available mechanisms. In this case a "quick-pick" which currently has no option for that.

brunnerh avatar Feb 12 '20 08:02 brunnerh

That's a bit of shame.

Would it be possible to make multiple calls to the quick-pick API and combine the results? So for example, searching for greek beta would make two calls: greek*beta and beta*greek and combine the results?

This should work fine for 2 and 3 word searches (the latter requiring 6 API calls which might slow things down, but should also return very few results). This is obviously not a scalable solution as the number of API calls required would grow factorially with the number of words, but I think it would be unlikely that more than 2 words is often necessary, let alone 3.

Alternatively, are there other VSCode extensions which could act as a drop-in replacement to the quick-pick call?

And as an interim 'fix', is it possible that it replaces all spaces with * automatically?

JP-Ellis avatar Feb 12 '20 09:02 JP-Ellis

That is unfortunately not how the API works. The dropdown list is a unit and automatically filteres upon input with no way to change its logic apart from modifying where it searches (items have a label, optional description and details).

If there is no other way i might consider the automatic replacement as a configuration option.

brunnerh avatar Feb 12 '20 13:02 brunnerh

Is it possible to use a similar API to the search used by workbench.action.showAllSymbols? That search is fuzzy, and uses the same (at least visually) search box.

JP-Ellis avatar Feb 28 '20 03:02 JP-Ellis

That appears to use some internals that are not exposed in the public API available to extensions.

There are already various issues open in the VS repository for functionality that would make it possible to implement a more lenient search. I will keep an eye on how that develops.

brunnerh avatar Mar 01 '20 17:03 brunnerh

any update on this?

fognome avatar Oct 08 '23 08:10 fognome

@fognome No, see upstream issue.

brunnerh avatar Oct 08 '23 12:10 brunnerh