-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Add tokenized search support to Quick Open dialog and FileSystem filter #88660
Add tokenized search support to Quick Open dialog and FileSystem filter #88660
Conversation
42774ca
to
c36f9eb
Compare
related #82200 |
As nobody else has commented about this: I would appreciate a bit of leniency towards typos. It's not as 'strange' of a feature if it helps people find the things they are looking for. |
That's totally fair, and my wording was not the greatest. I do think that my gripe was with the current implementation, which felt like a strange combination of high demand and leniency, and is also an odd exception amongst other instances of searching in the editor which do not suffer from the same issues despite not having typo-protection. I do think that the impact of typos is already greatly reduced with the leniency introduced by tokenization. And one must also consider that a search function needs to also eliminate results that do not match. False positives are also likely to slow down the search, particularly if the file you are searching for is not the first result and you have to look through a list of results. That said, something like what @Cammymoop linked could work well! I'll give it a try soon. |
I totally thought this too, but after looking at the different use cases, it turned out to be more different than similar. Handling paths for example is very different from handling just names. And handling search could also be different from handling filtering, depending on the UX requirements. For example, you might want typo-forgiveness in search, but you wouldn't want that in filtering. The only similarity turned out to be looping through an array of tokens obtained from ( |
@Mickeon Oh hmmm, you know, upon closer inspection, it looks like the FileSystem filter could definitely use your utility logic! |
It absolutely needs to be tackled separately (and maybe by someone that has even more understanding of the codebase) because it'd be a huge undertaking, and it would have to be applied literally everywhere. There are many filter LineEdits out there, and they all would benefit from mostly the same changes. I'm just pointing it out because code duplication is nasty. |
This was already supported (except the order part, but it's not often used I think?), with the caveat that you can't make spaces. From 4.3 dev4: KXBEchqhld.mp4 |
c36f9eb
to
b8b698a
Compare
b8b698a
to
fbfda46
Compare
Thanks! |
Apparently this no longer works. You are forced to make spaces now. I preferred the old way tbh >_> |
Requiring spaces seems somewhat nonstandard when taking into consideration things like VScode and ctrlp.vim. Is requiring spaces something we could make optional? |
See earlier comments in the thread. Both the old and new solutions have big caveats. There has to be a new algorithm implemented for search, in another PR, and would have to be used throughout the whole editor's search features for consistency and to limit code reuse. There were also candidates suggested. |
Thanks, understood, and can certainly understand the desire to standardize and DRY things up. Given that that's a lot of work, in the meantime, would adding an option on whether or not to require spaces be something the project would support. Not sure that I have time to contribute this, but wondering if it's the type of thing that's worth considering. |
I'm not sure how far away we are from a standard, but I would like to just add an FYI, if this is something someone wants to pursue: The option you're describing cannot be achieved as an option within the current algorithm. It would have to be a toggle between the old behaviour and the current behaviour, which would affect not only ordering of search results, but also whether certain ones show up at all, because they are fundamentally different algorithms. The current one cannot just toggle "requires spaces", because it fundamentally works by splitting the search string in the first place. |
I think these comments about space/no space handling have been effectively handled by this pr #82200. I made some changes which further improved matching on 3 personal projects (1 large, 2 small) which I used for testing. I'm not sure how much further work it would be to integrate that into the other search/filter modals though; potentially rather than have a static class we could configure class instances as matching contexts to tune each instance to the particular task, but still reuse the core matching logic. |
There is also #56772, which seems to change the behavior too (supporting both old search and the tokenized one). |
Closes #9145.
Tokenization
snake_case
orPascalCase
ordash-case
.Smart Sorting for Quick Open
Notes