add API command for declaration provider, #62483

This commit is contained in:
Johannes Rieken
2018-11-12 11:15:42 +01:00
parent 8bead9241f
commit f6bf792dea
2 changed files with 47 additions and 0 deletions

View File

@@ -47,6 +47,14 @@ export class ExtHostApiCommands {
],
returns: 'A promise that resolves to an array of Location-instances.'
});
this._register('vscode.executeDeclarationProvider', this._executeDeclaraionProvider, {
description: 'Execute all declaration provider.',
args: [
{ name: 'uri', description: 'Uri of a text document', constraint: URI },
{ name: 'position', description: 'Position of a symbol', constraint: types.Position }
],
returns: 'A promise that resolves to an array of Location-instances.'
});
this._register('vscode.executeTypeDefinitionProvider', this._executeTypeDefinitionProvider, {
description: 'Execute all type definition providers.',
args: [
@@ -292,6 +300,15 @@ export class ExtHostApiCommands {
.then(tryMapWith(typeConverters.location.to));
}
private _executeDeclaraionProvider(resource: URI, position: types.Position): Thenable<types.Location[]> {
const args = {
resource,
position: position && typeConverters.Position.from(position)
};
return this._commands.executeCommand<modes.Location[]>('_executeDeclarationProvider', args)
.then(tryMapWith(typeConverters.location.to));
}
private _executeTypeDefinitionProvider(resource: URI, position: types.Position): Thenable<types.Location[]> {
const args = {
resource,