提交 738d85a5 编写于 作者: M Matt Bierner

Don't return js/ts fix all for empty edits

上级 230baa73
......@@ -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<string>(['fixClassIncorrectlyImplementsInterface', 'spelling']).has(fix.fixName)) {
if (['fixClassIncorrectlyImplementsInterface', 'spelling'].includes(fix.fixName)) {
typeConverters.WorkspaceEdit.withFileCodeEdits(edit, this.client, fix.changes);
fixedDiagnostics.push(diagnostic);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册