add 'vscode.executeLinkProvider' command

This commit is contained in:
Johannes Rieken
2016-07-25 14:57:03 +02:00
parent c1b999fdb0
commit d9067043bc
6 changed files with 130 additions and 100 deletions

View File

@@ -147,7 +147,13 @@ class ExtHostApiCommands {
],
returns: 'A promise that resolves to an array of TextEdits.'
});
this._register('vscode.executeLinkProvider', this._executeDocumentLinkProvider, {
description: 'Execute document link provider.',
args: [
{ name: 'uri', description: 'Uri of a text document', constraint: URI }
],
returns: 'A promise that resolves to an array of DocumentLink-instances.'
});
this._register('vscode.previewHtml', (uri: URI, position?: vscode.ViewColumn, label?: string) => {
return this._commands.executeCommand('_workbench.previewHtml',
@@ -417,4 +423,12 @@ class ExtHostApiCommands {
}
});
}
private _executeDocumentLinkProvider(resource: URI): Thenable<vscode.DocumentLink[]> {
return this._commands.executeCommand<modes.ILink[]>('_executeLinkProvider', resource).then(value => {
if (Array.isArray(value)) {
return value.map(typeConverters.DocumentLink.to);
}
});
}
}