diff --git a/src/vs/workbench/api/common/extHostApiCommands.ts b/src/vs/workbench/api/common/extHostApiCommands.ts index ebe9352c103cc..e0ae9e2f5f95a 100644 --- a/src/vs/workbench/api/common/extHostApiCommands.ts +++ b/src/vs/workbench/api/common/extHostApiCommands.ts @@ -8,7 +8,7 @@ import { DisposableStore } from 'vs/base/common/lifecycle'; import * as vscode from 'vscode'; import * as typeConverters from 'vs/workbench/api/common/extHostTypeConverters'; import * as types from 'vs/workbench/api/common/extHostTypes'; -import { IRawColorInfo, IWorkspaceEditDto, ICallHierarchyItemDto } from 'vs/workbench/api/common/extHost.protocol'; +import { IRawColorInfo, IWorkspaceEditDto } from 'vs/workbench/api/common/extHost.protocol'; import { ISingleEditOperation } from 'vs/editor/common/model'; import * as modes from 'vs/editor/common/modes'; import * as search from 'vs/workbench/contrib/search/common/search'; @@ -182,22 +182,6 @@ export class ExtHostApiCommands { ], returns: 'A promise that resolves to an array of DocumentLink-instances.' }); - this._register('vscode.executeCallHierarchyProviderIncomingCalls', this._executeCallHierarchyIncomingCallsProvider, { - description: 'Execute call hierarchy provider for incoming calls', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI }, - { name: 'position', description: 'Position in a text document', constraint: types.Position }, - ], - returns: 'A promise that resolves to an array of CallHierarchyIncomingCall-instances.' - }); - this._register('vscode.executeCallHierarchyProviderOutgoingCalls', this._executeCallHierarchyOutgoingCallsProvider, { - description: 'Execute call hierarchy provider for outgoing calls', - args: [ - { name: 'uri', description: 'Uri of a text document', constraint: URI }, - { name: 'position', description: 'Position in a text document', constraint: types.Position }, - ], - returns: 'A promise that resolves to an array of CallHierarchyOutgoingCall-instances.' - }); this._register('vscode.executeDocumentColorProvider', this._executeDocumentColorProvider, { description: 'Execute document color provider.', args: [ @@ -573,36 +557,6 @@ export class ExtHostApiCommands { return this._commands.executeCommand('_executeLinkProvider', resource) .then(tryMapWith(typeConverters.DocumentLink.to)); } - - private async _executeCallHierarchyIncomingCallsProvider(resource: URI, position: types.Position): Promise { - type IncomingCallDto = { - from: ICallHierarchyItemDto; - fromRanges: IRange[]; - }; - const args = { resource, position: typeConverters.Position.from(position) }; - const calls = await this._commands.executeCommand('_executeCallHierarchyIncomingCalls', args); - - const result: vscode.CallHierarchyIncomingCall[] = []; - for (const call of calls) { - result.push(new types.CallHierarchyIncomingCall(typeConverters.CallHierarchyItem.to(call.from), call.fromRanges.map(typeConverters.Range.to))); - } - return result; - } - - private async _executeCallHierarchyOutgoingCallsProvider(resource: URI, position: types.Position): Promise { - type OutgoingCallDto = { - fromRanges: IRange[]; - to: ICallHierarchyItemDto; - }; - const args = { resource, position: typeConverters.Position.from(position) }; - const calls = await this._commands.executeCommand('_executeCallHierarchyOutgoingCalls', args); - - const result: vscode.CallHierarchyOutgoingCall[] = []; - for (const call of calls) { - result.push(new types.CallHierarchyOutgoingCall(typeConverters.CallHierarchyItem.to(call.to), call.fromRanges.map(typeConverters.Range.to))); - } - return result; - } } function tryMapWith(f: (x: T) => R) { diff --git a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.ts b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.ts index 64585a0844080..d6b50fd91c001 100644 --- a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.ts +++ b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.ts @@ -10,7 +10,6 @@ import { CancellationToken } from 'vs/base/common/cancellation'; import { LanguageFeatureRegistry } from 'vs/editor/common/modes/languageFeatureRegistry'; import { URI } from 'vs/base/common/uri'; import { IPosition } from 'vs/editor/common/core/position'; -import { registerDefaultLanguageCommand } from 'vs/editor/browser/editorExtensions'; import { isNonEmptyArray } from 'vs/base/common/arrays'; import { onUnexpectedExternalError } from 'vs/base/common/errors'; @@ -105,14 +104,3 @@ export class CallHierarchyModel { } } - -export async function provideIncomingCalls(model: ITextModel, position: IPosition, token: CancellationToken): Promise { - throw new Error(); -} - -export async function provideOutgoingCalls(model: ITextModel, position: IPosition, token: CancellationToken): Promise { - throw new Error(); -} - -registerDefaultLanguageCommand('_executeCallHierarchyIncomingCalls', async (model, position) => provideIncomingCalls(model, position, CancellationToken.None)); -registerDefaultLanguageCommand('_executeCallHierarchyOutgoingCalls', async (model, position) => provideOutgoingCalls(model, position, CancellationToken.None)); 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 94cb4acc0ad5b..1f9dd15dda5ca 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts @@ -856,37 +856,4 @@ suite('ExtHostLanguageFeatureCommands', function () { assert.equal(value.length, 1); assert.ok(value[0].parent); }); - - // --- call hierarcht - - test('Call Hierarchy, back and forth', async function () { - - disposables.push(extHost.registerCallHierarchyProvider(nullExtensionDescription, defaultSelector, new class implements vscode.CallHierarchyItemProvider { - prepareCallHierarchy(document: vscode.TextDocument) { - return new types.CallHierarchyItem(types.SymbolKind.Array, 'ROOT', '', document.uri, new types.Range(0, 0, 2, 0), new types.Range(0, 0, 2, 0)); - } - provideCallHierarchyIncomingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): vscode.ProviderResult { - return [ - new types.CallHierarchyIncomingCall(new types.CallHierarchyItem(types.SymbolKind.Array, 'IN', '', item.uri, new types.Range(0, 0, 2, 0), new types.Range(0, 0, 2, 0)), [new types.Range(0, 0, 0, 0)]), - ]; - } - provideCallHierarchyOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): vscode.ProviderResult { - return [ - new types.CallHierarchyOutgoingCall(new types.CallHierarchyItem(types.SymbolKind.Array, 'OUT', '', item.uri, new types.Range(0, 0, 2, 0), new types.Range(0, 0, 2, 0)), [new types.Range(0, 0, 0, 0)]), - ]; - } - })); - - await rpcProtocol.sync(); - - // let incoming = await commands.executeCommand('vscode.executeCallHierarchyProviderIncomingCalls', model.uri, new types.Position(0, 10)); - // assert.equal(incoming.length, 1); - // assert.ok(incoming[0].from instanceof types.CallHierarchyItem); - // assert.equal(incoming[0].from.name, 'IN'); - - // let outgoing = await commands.executeCommand('vscode.executeCallHierarchyProviderOutgoingCalls', model.uri, new types.Position(0, 10)); - // assert.equal(outgoing.length, 1); - // assert.ok(outgoing[0].to instanceof types.CallHierarchyItem); - // assert.equal(outgoing[0].to.name, 'OUT'); - }); });