Skip to content

Commit 5b3f41a

Browse files
committed
Add optional command to onAutoInsert response
1 parent d8a2d5b commit 5b3f41a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/lsptoolshost/onAutoInsert.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ async function applyAutoInsertEdit(
8888

8989
const applied = vscode.workspace.applyEdit(edit);
9090
if (!applied) {
91-
throw new Error('Tried to insert a comment but an error occurred.');
91+
throw new Error('Tried to apply an edit but an error occurred.');
92+
}
93+
94+
if (response.command !== undefined) {
95+
vscode.commands.executeCommand(response.command.command, response.command.arguments);
9296
}
9397
}
9498
}

src/lsptoolshost/roslynProtocol.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ export interface OnAutoInsertParams {
5959
export interface OnAutoInsertResponseItem {
6060
_vs_textEditFormat: lsp.InsertTextFormat;
6161
_vs_textEdit: lsp.TextEdit;
62+
63+
/**
64+
* An optional command that is executed *after* inserting.
65+
*/
66+
command?: Command;
6267
}
6368

6469
/**

0 commit comments

Comments
 (0)