diff options
-rw-r--r-- | src/vs/workbench/api/node/extHostApiCommands.ts | 3 | ||||
-rw-r--r-- | src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts | 29 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/vs/workbench/api/node/extHostApiCommands.ts b/src/vs/workbench/api/node/extHostApiCommands.ts index 010286e9672..2b00ff6d9f6 100644 --- a/src/vs/workbench/api/node/extHostApiCommands.ts +++ b/src/vs/workbench/api/node/extHostApiCommands.ts @@ -418,6 +418,9 @@ export class ExtHostApiCommands { if (codeAction.edit) { ret.edit = typeConverters.WorkspaceEdit.to(codeAction.edit); } + if (codeAction.command) { + ret.command = this._commands.converter.fromInternal(codeAction.command); + } return ret; } }); diff --git a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts index b11c79a035a..90ac6be2310 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts @@ -400,6 +400,35 @@ suite('ExtHostLanguageFeatureCommands', function () { }); }); + test('vscode.executeCodeActionProvider results seem to be missing their `command` property #45124', function () { + disposables.push(extHost.registerCodeActionProvider(defaultSelector, { + provideCodeActions(document, range): vscode.CodeAction[] { + return [{ + command: { + arguments: [document, range], + command: 'command', + title: 'command_title', + }, + kind: types.CodeActionKind.Empty.append('foo'), + title: 'title', + }]; + } + })); + + return rpcProtocol.sync().then(() => { + return commands.executeCommand<vscode.CodeAction[]>('vscode.executeCodeActionProvider', model.uri, new types.Range(0, 0, 1, 1)).then(value => { + assert.equal(value.length, 1); + let [first] = value; + assert.ok(first.command); + assert.equal(first.command.command, 'command'); + assert.equal(first.command.title, 'command_title'); + assert.equal(first.kind.value, 'foo'); + assert.equal(first.title, 'title'); + + }); + }); + }); + // --- code lens test('CodeLens, back and forth', function () { |