Skip to content

Commit

Permalink
more tweaks #34968
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed May 7, 2018
1 parent 841f140 commit 681a9e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ declare module 'vscode' {
}

export interface DocumentSymbolProvider {
provideDocumentSymbols(document: TextDocument, token: CancellationToken): ProviderResult<HierarchicalSymbolInformation | SymbolInformation[]>;
provideDocumentSymbols(document: TextDocument, token: CancellationToken): ProviderResult<HierarchicalSymbolInformation[] | SymbolInformation[]>;
}

//#endregion
Expand Down
14 changes: 8 additions & 6 deletions src/vs/workbench/api/node/extHostLanguageFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import { mixin } from 'vs/base/common/objects';
import * as vscode from 'vscode';
import * as typeConvert from 'vs/workbench/api/node/extHostTypeConverters';
import { Range, Disposable, CompletionList, SnippetString, CodeActionKind, HierarchicalSymbolInformation } from 'vs/workbench/api/node/extHostTypes';
import { Range, Disposable, CompletionList, SnippetString, CodeActionKind, HierarchicalSymbolInformation, SymbolInformation } from 'vs/workbench/api/node/extHostTypes';
import { ISingleEditOperation } from 'vs/editor/common/model';
import * as modes from 'vs/editor/common/modes';
import { ExtHostHeapService } from 'vs/workbench/api/node/extHostHeapService';
Expand Down Expand Up @@ -39,13 +39,15 @@ class OutlineAdapter {
provideDocumentSymbols(resource: URI): TPromise<SymbolInformationDto[]> {
let doc = this._documents.getDocumentData(resource).document;
return asWinJsPromise(token => this._provider.provideDocumentSymbols(doc, token)).then(value => {
if (value instanceof HierarchicalSymbolInformation) {
return [typeConvert.HierarchicalSymbolInformation.from(value)];
if (isFalsyOrEmpty(value)) {
return undefined;
}
if (Array.isArray(value)) {
return value.map(typeConvert.SymbolInformation.from);
let [probe] = value;
if (probe instanceof HierarchicalSymbolInformation) {
return (<HierarchicalSymbolInformation[]>value).map(typeConvert.HierarchicalSymbolInformation.from);
} else {
return (<SymbolInformation[]>value).map(typeConvert.SymbolInformation.from);
}
return undefined;
});
}
}
Expand Down

0 comments on commit 681a9e0

Please sign in to comment.