mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CodeCompletion] Don't fuzzy-match on single characters
Use prefix matching on the first character, switch to fuzzy after 2 or more. With only a single character, we often get silly fuzzy results.
This commit is contained in:
@@ -488,7 +488,7 @@ void CodeCompletionOrganizer::Impl::addCompletionsWithFilter(
|
||||
pattern.normalize = true;
|
||||
for (Completion *completion : completions) {
|
||||
bool match = false;
|
||||
if (options.fuzzyMatching) {
|
||||
if (options.fuzzyMatching && filterText.size() >= options.minFuzzyLength) {
|
||||
match = pattern.matchesCandidate(completion->getName());
|
||||
} else {
|
||||
match = completion->getName().startswith_lower(filterText);
|
||||
|
||||
Reference in New Issue
Block a user