-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Could autocompletion be improved?
I'd like to be able to list things similarly to EnchantIDE, depending on the setting...
// default
let DEFAULT_SIZE_LIST = 20
let SUGGESTION_ENGINE_TYPE = "AKIN";
// Can be "EXACT" o "FUZZY" o "AKIN"
let SUGGESTION_SORT_TYPE = "SIMILAR";
// Can be "OFF" "SIMPLE" o "SIMILAR"DEFAULT_SIZE_LIST
Limiting results is useful on low-power computers, if you're emulating it, or even if you just want to prevent autocomplete from always taking up the entire screen when it feels like it...
SUGGESTION_ENGINE_TYPE
The engine only selects whether one of the matches is displayed or not.
All of these are added to the visible list according to your decision.
EXACT
It's the one that's been in Sanny Builder for as long as I can remember.
Only add the suggestion if the text starts with that one.
Example:
input: "Car"
output:
| Car ✅
| CarDecks ✅
| DoorCar ❌
| AvatarStar ❌
FUZZY
Add to the suggestion list, as long as the word is found somewhere, at the beginning, at the end, in the middle... anywhere in the text.
Example:
input: "Car"
output:
| Car ✅
| CarDecks ✅
| DoorCar ✅
| AvatarStar ❌
AKIN
It's a slightly more expensive algorithm than FUZZY, but you can get a nicer list if you misspelled something. It makes the editor smarter and more user-friendly.
Example:
input: "Bar"
output:
| Car ✅
| CarDecks ✅
| DoorCar ✅
| AvatarStar ✅
I recommend implementing it with some optimization algorithms such as Throttle, Memoize, Debounce, and NormalizeString.
To avoid having to calculate the same similarities over and over again, save them in a buffer or cache. And have them calculated 100ms after the last keystroke.
SUGGESTION_SORT_TYPE
We already know that Sanny Builder can change the order of the list... from A to Z, Z to A, and by opcode lowest to highest
but... who uses them?
OFF
The results are kept in the order in which they appeared in the suggestion list.
(Of course, EnchantIDE doesn't sort the databases so the results come out mixed.)
Simple
Apply the order of a lifetime, from A to Z.
SIMILAR
The search is scored based on the similarity of the suggestion.
And based on that score, it is displayed higher or lower in the list.
IMPORTANT
Obviously, this would also be good if it could be configured from the settings and preferences panel of Sanny Builder.