mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
Still show fix all actions for fix-all actions that can fix multiple errors with multple different diagnostics
This commit is contained in:
@@ -286,7 +286,12 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider {
|
||||
}
|
||||
|
||||
// Make sure there are multiple diagnostics of the same type in the file
|
||||
if (!this.diagnosticsManager.getDiagnostics(document.uri).some(x => x.code === diagnostic.code && x !== diagnostic)) {
|
||||
if (!this.diagnosticsManager.getDiagnostics(document.uri).some(x => {
|
||||
if (x === diagnostic) {
|
||||
return false;
|
||||
}
|
||||
return x.code === diagnostic.code || fixAllErrorCodes.get(x.code as number) === diagnostic.code;
|
||||
})) {
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -304,6 +309,15 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider {
|
||||
}
|
||||
}
|
||||
|
||||
// Some fix all actions can actually fix multiple differnt diagnostics. Make sure we still show the fix all action
|
||||
// in such cases
|
||||
const fixAllErrorCodes = new Map<number, number>([
|
||||
// Missing async
|
||||
[2339, 2339],
|
||||
[2345, 2339],
|
||||
]);
|
||||
|
||||
|
||||
const preferredFixes = new Set([
|
||||
'annotateWithTypeFromJSDoc',
|
||||
'constructorForDerivedNeedSuperCall',
|
||||
|
||||
Reference in New Issue
Block a user