mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Suggestions now use diagnosticCollection (#32740)
Previously they used multiMaps, unlike all the other diagnostics. This prevents duplicate suggestions, like other kinds diagnostics. Fixes #28710
This commit is contained in:
committed by
GitHub
parent
cc3db8f448
commit
269c3d3a56
@@ -585,7 +585,7 @@ namespace ts {
|
||||
checkSourceFile(file);
|
||||
Debug.assert(!!(getNodeLinks(file).flags & NodeCheckFlags.TypeChecked));
|
||||
|
||||
diagnostics = addRange(diagnostics, suggestionDiagnostics.get(file.fileName));
|
||||
diagnostics = addRange(diagnostics, suggestionDiagnostics.getDiagnostics(file.fileName));
|
||||
if (!file.isDeclarationFile && (!unusedIsError(UnusedKind.Local) || !unusedIsError(UnusedKind.Parameter))) {
|
||||
addUnusedDiagnostics();
|
||||
}
|
||||
@@ -848,8 +848,7 @@ namespace ts {
|
||||
const awaitedTypeStack: number[] = [];
|
||||
|
||||
const diagnostics = createDiagnosticCollection();
|
||||
// Suggestion diagnostics must have a file. Keyed by source file name.
|
||||
const suggestionDiagnostics = createMultiMap<DiagnosticWithLocation>();
|
||||
const suggestionDiagnostics = createDiagnosticCollection();
|
||||
|
||||
const typeofTypesByName: ReadonlyMap<Type> = createMapFromTemplate<Type>({
|
||||
string: stringType,
|
||||
@@ -944,7 +943,7 @@ namespace ts {
|
||||
diagnostics.add(diagnostic);
|
||||
}
|
||||
else {
|
||||
suggestionDiagnostics.add(diagnostic.file.fileName, { ...diagnostic, category: DiagnosticCategory.Suggestion });
|
||||
suggestionDiagnostics.add({ ...diagnostic, category: DiagnosticCategory.Suggestion });
|
||||
}
|
||||
}
|
||||
function errorOrSuggestion(isError: boolean, location: Node, message: DiagnosticMessage | DiagnosticMessageChain, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): void {
|
||||
|
||||
Reference in New Issue
Block a user