提交 9e6a5257 编写于 作者: M Matt Bierner

Fixing fix all not applying correct commands on edit

上级 690744c3
......@@ -43,7 +43,7 @@ class ApplyCodeActionCommand implements Command {
fixName: action.fixName
});
}
return applyCodeActionCommands(this.client, action);
return applyCodeActionCommands(this.client, action.commands);
}
}
......@@ -86,17 +86,14 @@ class ApplyFixAllCodeAction implements Command {
};
try {
const combinedCodeFixesResponse = await this.client.execute('getCombinedCodeFix', args);
if (!combinedCodeFixesResponse.body) {
const { body } = await this.client.execute('getCombinedCodeFix', args);
if (!body) {
return;
}
const edit = typeConverters.WorkspaceEdit.fromFileCodeEdits(this.client, combinedCodeFixesResponse.body.changes);
const edit = typeConverters.WorkspaceEdit.fromFileCodeEdits(this.client, body.changes);
await vscode.workspace.applyEdit(edit);
if (combinedCodeFixesResponse.command) {
await vscode.commands.executeCommand(ApplyCodeActionCommand.ID, combinedCodeFixesResponse.command);
}
await applyCodeActionCommands(this.client, body.commands);
} catch {
// noop
}
......
......@@ -27,15 +27,15 @@ export async function applyCodeAction(
return false;
}
}
return applyCodeActionCommands(client, action);
return applyCodeActionCommands(client, action.commands);
}
export async function applyCodeActionCommands(
client: ITypeScriptServiceClient,
action: Proto.CodeAction
commands: ReadonlyArray<{}> | undefined
): Promise<boolean> {
if (action.commands && action.commands.length) {
for (const command of action.commands) {
if (commands && commands.length) {
for (const command of commands) {
const response = await client.execute('applyCodeActionCommand', { command });
if (!response || !response.body) {
return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册