add resolveWorkspaceSymbol method and wire it up, not yet exposed in the API

This commit is contained in:
Johannes Rieken
2016-08-02 16:15:15 +02:00
parent 36a2a04f86
commit e62cfe9734
8 changed files with 119 additions and 76 deletions

View File

@@ -16,7 +16,7 @@ import {ICommandHandlerDescription} from 'vs/platform/commands/common/commands';
import {ExtHostCommands} from 'vs/workbench/api/node/extHostCommands';
import {IQuickFix2} from 'vs/editor/contrib/quickFix/common/quickFix';
import {IOutline} from 'vs/editor/contrib/quickOpen/common/quickOpen';
import {ITypeBearing} from 'vs/workbench/parts/search/common/search';
import {IWorkspaceSymbolProvider, IWorkspaceSymbol} from 'vs/workbench/parts/search/common/search';
import {ICodeLensData} from 'vs/editor/contrib/codelens/common/codelens';
export function registerApiCommands(commands:ExtHostCommands) {
@@ -240,10 +240,14 @@ class ExtHostApiCommands {
* @return A promise that resolves to an array of symbol information.
*/
private _executeWorkspaceSymbolProvider(query: string): Thenable<types.SymbolInformation[]> {
return this._commands.executeCommand<ITypeBearing[]>('_executeWorkspaceSymbolProvider', { query }).then(value => {
return this._commands.executeCommand<[IWorkspaceSymbolProvider, IWorkspaceSymbol[]][]>('_executeWorkspaceSymbolProvider', { query }).then(value => {
const result: types.SymbolInformation[] = [];
if (Array.isArray(value)) {
return value.map(typeConverters.toSymbolInformation);
for (const tuple of value) {
result.push(...tuple[1].map(typeConverters.toSymbolInformation));
}
}
return result;
});
}