Only 100 spelling corrections for unknown symbols

If your compilation has more than 100 unknown symbols, the problem is
missing declarations, not typos.
This commit is contained in:
Nathan Shively-Sanders
2017-05-01 12:58:42 -07:00
parent 2479c071f9
commit ca7d7f5946
4 changed files with 536 additions and 1 deletions

View File

@@ -318,6 +318,8 @@ namespace ts {
const resolutionResults: boolean[] = [];
const resolutionPropertyNames: TypeSystemPropertyName[] = [];
let suggestionCount = 0;
const maximumSuggestionCount = 100;
const mergedSymbols: Symbol[] = [];
const symbolLinks: SymbolLinks[] = [];
const nodeLinks: NodeLinks[] = [];
@@ -1091,9 +1093,10 @@ namespace ts {
!checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) &&
!checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning)) {
let suggestion: string | undefined;
if (suggestedNameNotFoundMessage) {
if (suggestedNameNotFoundMessage && suggestionCount < maximumSuggestionCount) {
suggestion = getSuggestionForNonexistentSymbol(originalLocation, name, meaning);
if (suggestion) {
suggestionCount++;
error(errorLocation, suggestedNameNotFoundMessage, typeof nameArg === "string" ? nameArg : declarationNameToString(nameArg), suggestion);
}
}