diff options
Diffstat (limited to 'clang-tools-extra/clangd/FuzzyMatch.cpp')
| -rw-r--r-- | clang-tools-extra/clangd/FuzzyMatch.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/FuzzyMatch.cpp b/clang-tools-extra/clangd/FuzzyMatch.cpp index 152f1799777..0fc2e32c523 100644 --- a/clang-tools-extra/clangd/FuzzyMatch.cpp +++ b/clang-tools-extra/clangd/FuzzyMatch.cpp @@ -101,7 +101,13 @@ Optional<float> FuzzyMatcher::match(StringRef Word) { Scores[PatN][WordN][Match].Score); if (isAwful(Best)) return None; - return ScoreScale * std::min(PerfectBonus * PatN, std::max<int>(0, Best)); + float Score = + ScoreScale * std::min(PerfectBonus * PatN, std::max<int>(0, Best)); + // If the pattern is as long as the word, we have an exact string match, + // since every pattern character must match something. + if (WordN == PatN) + Score *= 2; // May not be perfect 2 if case differs in a significant way. + return Score; } // Segmentation of words and patterns. |

