From 738d85a51e56b9d373632511b633d6884bef4d1d Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 14 Nov 2019 11:46:13 -0800 Subject: [PATCH] Don't return js/ts fix all for empty edits --- .../typescript-language-features/src/features/fixAll.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extensions/typescript-language-features/src/features/fixAll.ts b/extensions/typescript-language-features/src/features/fixAll.ts index d9461442e51..c65dbf472a6 100644 --- a/extensions/typescript-language-features/src/features/fixAll.ts +++ b/extensions/typescript-language-features/src/features/fixAll.ts @@ -82,6 +82,10 @@ class TypeScriptAutoFixProvider implements vscode.CodeActionProvider { return undefined; } const { edit, fixedDiagnostics } = autoFixResponse; + if (!edit.size) { + return undefined; + } + const codeAction = new vscode.CodeAction( localize('autoFix.label', 'Auto fix'), TypeScriptAutoFixProvider.kind); @@ -105,11 +109,11 @@ class TypeScriptAutoFixProvider implements vscode.CodeActionProvider { }; const response = await this.client.execute('getCodeFixes', args, token); if (response.type !== 'response' || !response.body || response.body.length > 1) { - return undefined; + continue; } const fix = response.body[0]; - if (new Set(['fixClassIncorrectlyImplementsInterface', 'spelling']).has(fix.fixName)) { + if (['fixClassIncorrectlyImplementsInterface', 'spelling'].includes(fix.fixName)) { typeConverters.WorkspaceEdit.withFileCodeEdits(edit, this.client, fix.changes); fixedDiagnostics.push(diagnostic); }