This commit is contained in:
Johannes Rieken 2018-03-06 11:39:16 +01:00
parent bde23fb906
commit 18b94d09a6
2 changed files with 32 additions and 0 deletions

View file

@ -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;
}
});

View file

@ -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 () {