-
Notifications
You must be signed in to change notification settings - Fork 173
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Option for 'smart' fuzzy search #5509
Comments
Current fuzzy algo is described here |
Current fuzzy:
Current non fuzzy:
Suggestion (VSCode behavior):
Match example: Another match example: It's like searching people names by their initials. Relevant: |
OK, todo. |
Beta updated. one thing. bug or not? 'basc' cannot find 'Bash script'. but should it? 'bas' matches 3 chars in "Bash" and last 'c' don't match (not at word begin). |
Thank you. Could you please make it work in autocomplete? My main use for this feature is to use in JavaScript things such as |
Good question. Yes, I think it's a bug, it should find. |
autocomplete is not the menu-like dlg. it uses plugin (python) fuzzy filter. it is LSP's code. maybe veksha can show me where is this code in LSP? |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as outdated.
This comment was marked as outdated.
Solved. beta updated. I am not sure it is fully OK. |
My last code cannot do it too. too many words I guess. but I already do loop 'from 0 to 255' per each string, it is slow already. |
'Add data breakpoint at address' |
From what I'm seeing, the start of the string needs to be the start of a word for the fuzzy search to become active. Example: Surprisingly, VSCode behaves the same way, so if you think it's fine... But I feel it shouldn't be this way. The start of the string can be any part of a word. Only when you start connecting to a different word that there's the need to start from the first char... |
works after my new fix. |
Last beta 73 works worse ('basc' is not found for 'bash script'), ignore it. |
https://wiki.freepascal.org/CudaText#Command_Palette |
Suggestion for algorithm: First, internally replace capital letters in items array by adding a white space at the left. So Then, first run a full-fuzzy search. Suppose find input is If there are matches, you collect them and test each pair of chars:
So Cuda will run Spaces in find input are treated as Word boundary This code is efficient, shouldn't be slow for any size of find string. |
Wait... this algorithm is not complete.
|
Can I collect them all? regex engine allows to find 1st match for given regex, not all possible matches. |
The solution can be capturing from regex result and carrying to next regex. I'll say in terms of JavaScript regex, don't know if Pascal is different. Instead of Suppose the item So in the next step Cuda would reuse these values in the regex between OR So instead of By doing this, But by doing this you're using different regex for each match. So it will be no longer |
The full-fuzzy would be just to discard early items that don't match. It's not needed to find multiple matches for the same item, this step is just to avoid doing useless work in next steps by searching in items you're already sure won't match at the end. |
I can try, but I'm not good with English, result might be bad. For instance, |
Yes, I see this issue too. 'cancel' word breaks finding of 'carets'. 'ca' too. |
What we need here it the algo (in Pascal) which can find ALL combinations of fuzzy positions in a given text.
If we create this func, later steps are trivial! ie checking combinations for validity. valid combinations here are only 2. now I reverted fuzzy code to old one (1.214.0). until we write this algo. |
Note: example above: must find not 5 items, but much more! because 'c' can be from e.g. 'ca22' and 'a' can be from different next word e.g. '44ca'. |
Algorithm that I believe would work. Example of input string: "folfil".
Continuing next steps of the given example til the end:
Another example: Steps:
Slightly different example: Steps:
Other example: Steps:
Non-match example: Steps:
|
Maybe I will read your idea in details, but later, in mid-summer. no promise. I must convert the idea to pascal first. only @dinkumoil knows the pascal here, so he may help if he wants. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
One thing I like in VSCode is the semi fuzzy search, both in Command palette and in autocomplete suggestions.
I mean, it's fuzzy only for the first letter of the word and for capital letters, and only if it follows left-to-right order.
Examples:
folfil
in Command palette suggestsopen FOLder containing the current FILe
.document.qs
in editor suggestsdocument.querySelector
in autocomplete popup.Current Cuda has
ui_listbox_fuzzy
which is even enabled by default but I disable it as it suggests items very much unrelated to what was typed.Edit: just correcting myself, this semi fuzzy is only used in VSCode for Command palette. For autocomplete in editor, the simple unrestricted fuzzy search is used.
The text was updated successfully, but these errors were encountered: