Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Fuzzy Search? #13

Open
JP-Ellis opened this issue Feb 12, 2020 · 9 comments
Open

Use Fuzzy Search? #13

JP-Ellis opened this issue Feb 12, 2020 · 9 comments
Labels
enhancement New feature or request upstream (vscode) The issue originates in VS Code and cannot be handled at the extension level.

Comments

@JP-Ellis
Copy link

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).

@brunnerh
Copy link
Owner

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.

@JP-Ellis
Copy link
Author

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?

@brunnerh
Copy link
Owner

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.

@JP-Ellis
Copy link
Author

JP-Ellis commented Feb 28, 2020

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.

@brunnerh
Copy link
Owner

brunnerh commented Mar 1, 2020

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 brunnerh added the enhancement New feature or request label May 1, 2020
@brunnerh brunnerh added the upstream (vscode) The issue originates in VS Code and cannot be handled at the extension level. label Mar 30, 2022
@fognome
Copy link

fognome commented Oct 8, 2023

any update on this?

@brunnerh
Copy link
Owner

brunnerh commented Oct 8, 2023

@fognome No, see upstream issue.

@lionel-rowe
Copy link

Are there alternative, lower-level UI components that could be used instead of QuickPick? Input noticeably lags on my machine, which could be mitigated by running the search logic in workers, or throttling input, or virtualizing the list elements (if that isn't done already), or some combination of the above. It seems like QuickPick isn't really intended for searching through tens of thousands of items as it doesn't have these customization options.

As well as performance and fuzziness, matching by alternate names would also be helpful, e.g. I expected to see 0x7d MULTIPLICATION SIGN as an option when searching for times.

@brunnerh
Copy link
Owner

There are no alternatives that I know of. The quick pick is virtualized, otherwise it would be way worse (it used to not be virtualized). A proposed option for delaying the search is already part the issue I opened.

The extension has an option to use an initial search followed by paging in the quick pick, you could try using that; the downside is lack of live feedback on the initial search and having to deal with pages.

"insert-unicode.disable-pre-filtering": false,
"insert-unicode.page-size": 500, // default, you can probably go higher here

For matching, there are alternatives for some characters based on a Unicode-proveded list, some characters have quite a few but most have none. E.g. line feed (0xA):

LINE FEED, NEW LINE, END OF LINE, LF, NL, EOL

I do not intend to extend this at the moment, though. The list of characters is huge and often this will be a one-time problem, eventually the character is found and the user now knows what to look for (and the character is at least locally added to the recently used list). Adding additional aliases may also cause characters to show up when people are looking for something else, so it can also potentially degrade the experience.

Would recommend using the favorites for characters you need frequently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request upstream (vscode) The issue originates in VS Code and cannot be handled at the extension level.
Projects
None yet
Development

No branches or pull requests

4 participants