-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Autocomplete matching should be case insensitive, otherwise case mismatch leads to confusing results #63706
Comments
I believe this behavior is intentional, it allows you to type something like "rb" to bring up Rigidbody Edit: it's weird that |
I think is that it isn't ranked. What I mean is that results that does not need fuzzy search should be above as they are way more accurate. I thought this was already done but it might not be. |
Yes should be ranked and should not be case sensitive. |
Looking at a possible implementation in code we can simply create a custom sorter that will be run around the end of Something in the line of: struct CodeCompletionRankComparator {
_FORCE_INLINE_ bool operator()(const ScriptLanguage::CodeCompletionOption &p, const ScriptLanguage::CodeCompletionOption &q) const {
if (p.matches.is_empty() || q.matches.is_empty()) {
return false;
}
auto distance_between_tokens_accumulator = [](int current, const Pair<int, int> &pos) {
return current + (pos.second - pos.first);
};
int p_distance_between_matches = std::accumulate(p.matches.begin(), p.matches.end(), p.matches[0].first, distance_between_tokens_accumulator);
int q_distance_between_matches = std::accumulate(q.matches.begin(), q.matches.end(), q.matches[0].first, distance_between_tokens_accumulator);
return p_distance_between_matches > q_distance_between_matches;
}
}; |
Most of the time, devs will know they are looking for something that begins with 'xyz'. Autocompletion is meant for typing faster, then possibly for lookup (and if you don't know, you consult the docs). Trying to be clever about it with spaced out characters matching in the middle is counter intuitive and a hindrance. I think the priority should be all strings that begin with xyz at the top of list. Any strings that match xyz substring fall at the end in the list. No fuzzy logic or mixed in characters. |
I think there are people using fuzzy search and it is in fact good when you miss a letter or forgot there is something in between. But I think that it should be ordered as follow:
The questions would be how should they be order inside of it.For the first two going by lexicographic order should be good. For the last one I would go for how many part there is in the fuzzy search has search results with a ton of small parts are the ones we want to get rid of. |
Sounds good. Should it also be case insensitive? |
I think it should be case insensitive as you might forgot to put them or put two instead of one at the end. Maybe it would be good to make case sensitive match ranked higher but not sure if it is that important |
Godot version
v4.0.alpha13.official [59dcddc45]
System information
Mac OS X (Catalina) 10.15.7
Issue description
Autocomplete is too broad that includes any letters typed in.
Steps to reproduce
See screen shot
Minimal reproduction project
see screen shot
The text was updated successfully, but these errors were encountered: