Option for 'smart' fuzzy search #5602
Replies: 31 comments
-
Current fuzzy algo is described here |
Beta Was this translation helpful? Give feedback.
-
Current fuzzy:
Current non fuzzy:
Suggestion (VSCode behavior):
Match example: Another match example: It's like searching people names by their initials. Relevant: |
Beta Was this translation helpful? Give feedback.
-
OK, todo. |
Beta Was this translation helpful? Give feedback.
-
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). |
Beta Was this translation helpful? Give feedback.
-
Thank you. Could you please make it work in autocomplete? My main use for this feature is to use in JavaScript things such as |
Beta Was this translation helpful? Give feedback.
-
Good question. Yes, I think it's a bug, it should find. |
Beta Was this translation helpful? Give feedback.
-
VSCode doesn't have this issue, see: Current Cuda wouldn't be able to find this entry, it will stop at |
Beta Was this translation helpful? Give feedback.
-
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? |
Beta Was this translation helpful? Give feedback.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been hidden.
This comment has been hidden.
-
Solved. beta updated. I am not sure it is fully OK. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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... |
Beta Was this translation helpful? Give feedback.
-
works after my new fix. |
Beta Was this translation helpful? Give feedback.
-
Last beta 73 works worse ('basc' is not found for 'bash script'), ignore it. |
Beta Was this translation helpful? Give feedback.
-
https://wiki.freepascal.org/CudaText#Command_Palette |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
Wait... this algorithm is not complete.
|
Beta Was this translation helpful? Give feedback.
-
Can I collect them all? regex engine allows to find 1st match for given regex, not all possible matches. |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
I can try, but I'm not good with English, result might be bad. For instance, |
Beta Was this translation helpful? Give feedback.
-
Yes, I see this issue too. 'cancel' word breaks finding of 'carets'. 'ca' too. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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'. |
Beta Was this translation helpful? Give feedback.
-
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:
|
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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.
Beta Was this translation helpful? Give feedback.
All reactions