提交 b04c6f9e 编写于 作者: J Johannes Rieken

update API command for #85533

上级 9227460d
......@@ -86,7 +86,7 @@ const newCommands: ApiCommand[] = [
new ApiCommand(
'vscode.prepareCallHierarchy', '_executePrepareCallHierarchy', 'Prepare call hierarchy at a position inside a document',
[ApiCommandArgument.Uri, ApiCommandArgument.Position],
new ApiCommandResult<ICallHierarchyItemDto, types.CallHierarchyItem>('A CallHierarchyItem or undefined', v => typeConverters.CallHierarchyItem.to(v))
new ApiCommandResult<ICallHierarchyItemDto[], types.CallHierarchyItem[]>('A CallHierarchyItem or undefined', v => v.map(typeConverters.CallHierarchyItem.to))
),
new ApiCommand(
'vscode.provideIncomingCalls', '_executeProvideIncomingCalls', 'Compute incoming calls for an item',
......
......@@ -172,7 +172,7 @@ CommandsRegistry.registerCommand('_executePrepareCallHierarchy', async (accessor
_models.delete(key);
}
});
return model.root;
return [model.root];
} finally {
dispose(textModelReference);
......
......@@ -885,16 +885,17 @@ suite('ExtHostLanguageFeatureCommands', function () {
await rpcProtocol.sync();
const root = await commands.executeCommand<vscode.CallHierarchyItem>('vscode.prepareCallHierarchy', model.uri, new types.Position(0, 0));
const root = await commands.executeCommand<vscode.CallHierarchyItem[]>('vscode.prepareCallHierarchy', model.uri, new types.Position(0, 0));
assert.ok(root);
assert.equal(root.name, 'ROOT');
assert.ok(Array.isArray(root));
assert.equal(root.length, 1);
assert.equal(root[0].name, 'ROOT');
const incoming = await commands.executeCommand<vscode.CallHierarchyIncomingCall[]>('vscode.provideIncomingCalls', root);
const incoming = await commands.executeCommand<vscode.CallHierarchyIncomingCall[]>('vscode.provideIncomingCalls', root[0]);
assert.equal(incoming.length, 1);
assert.equal(incoming[0].from.name, 'INCOMING');
const outgoing = await commands.executeCommand<vscode.CallHierarchyOutgoingCall[]>('vscode.provideOutgoingCalls', root);
const outgoing = await commands.executeCommand<vscode.CallHierarchyOutgoingCall[]>('vscode.provideOutgoingCalls', root[0]);
assert.equal(outgoing.length, 1);
assert.equal(outgoing[0].to.name, 'OUTGOING');
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册