mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 21:06:50 -05:00
Favour exact-match spelling suggestions
Previously, the first match that was close enough was returned as the spelling suggestion. Now, if there is a candidate that differs only by case, it will always be the suggestion.
This commit is contained in:
@@ -14522,6 +14522,7 @@ namespace ts {
|
||||
const maximumLengthDifference = Math.min(3, name.length * 0.34);
|
||||
let bestDistance = Number.MAX_VALUE;
|
||||
let bestCandidate = undefined;
|
||||
let justCheckExactMatches = false;
|
||||
if (name.length > 30) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -14534,6 +14535,9 @@ namespace ts {
|
||||
if (candidateName === name) {
|
||||
return candidate;
|
||||
}
|
||||
if (justCheckExactMatches) {
|
||||
continue;
|
||||
}
|
||||
if (candidateName.length < 3 ||
|
||||
name.length < 3 ||
|
||||
candidateName === "eval" ||
|
||||
@@ -14549,7 +14553,8 @@ namespace ts {
|
||||
continue;
|
||||
}
|
||||
if (distance < 3) {
|
||||
return candidate;
|
||||
justCheckExactMatches = true;
|
||||
bestCandidate = candidate;
|
||||
}
|
||||
else if (distance < bestDistance) {
|
||||
bestDistance = distance;
|
||||
|
||||
Reference in New Issue
Block a user