diff --git a/extensions/typescript-language-features/src/features/documentSymbol.ts b/extensions/typescript-language-features/src/features/documentSymbol.ts index b07bc9b47a0..3106fb0f361 100644 --- a/extensions/typescript-language-features/src/features/documentSymbol.ts +++ b/extensions/typescript-language-features/src/features/documentSymbol.ts @@ -92,6 +92,7 @@ class TypeScriptDocumentSymbolProvider implements vscode.DocumentSymbolProvider private static convertNavTree(resource: vscode.Uri, bucket: vscode.DocumentSymbol[], item: Proto.NavigationTree): boolean { const symbolInfo = new vscode.DocumentSymbol( item.text, + '', getSymbolKind(item.kind), typeConverters.Range.fromTextSpan(item.spans[0]), typeConverters.Range.fromTextSpan(item.spans[0]), diff --git a/src/vs/editor/common/modes.ts b/src/vs/editor/common/modes.ts index e1e99e987df..995d0b874c6 100644 --- a/src/vs/editor/common/modes.ts +++ b/src/vs/editor/common/modes.ts @@ -645,6 +645,7 @@ export const symbolKindToCssClass = (function () { export interface DocumentSymbol { name: string; + detail: string; kind: SymbolKind; containerName?: string; fullRange: IRange; diff --git a/src/vs/editor/contrib/quickOpen/quickOpen.ts b/src/vs/editor/contrib/quickOpen/quickOpen.ts index c75aa9e8fc0..32bc5aa6280 100644 --- a/src/vs/editor/contrib/quickOpen/quickOpen.ts +++ b/src/vs/editor/contrib/quickOpen/quickOpen.ts @@ -47,6 +47,7 @@ function flatten(bucket: DocumentSymbol[], entries: DocumentSymbol[], overrideCo bucket.push({ kind: entry.kind, name: entry.name, + detail: entry.detail, containerName: entry.containerName || overrideContainerLabel, fullRange: entry.fullRange, identifierRange: entry.identifierRange, diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 511e6725cde..2a3c5a20730 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -4873,6 +4873,7 @@ declare namespace monaco.languages { export interface DocumentSymbol { name: string; + detail: string; kind: SymbolKind; containerName?: string; fullRange: IRange; diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 1b3e2a47a18..3660bb56385 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -386,6 +386,11 @@ declare module 'vscode' { */ name: string; + /** + * More detail for this symbol, e.g the signature of a function. + */ + detail: string; + /** * The kind of this symbol. */ @@ -411,11 +416,12 @@ declare module 'vscode' { * Creates a new document symbol. * * @param name The name of the symbol. + * @param detail Details for the symbol. * @param kind The kind of the symbol. * @param fullRange The full range of the symbol. * @param gotoRange The range that should be reveal. */ - constructor(name: string, kind: SymbolKind, fullRange: Range, gotoRange: Range); + constructor(name: string, detail: string, kind: SymbolKind, fullRange: Range, gotoRange: Range); } export interface DocumentSymbolProvider { diff --git a/src/vs/workbench/api/node/extHostTypeConverters.ts b/src/vs/workbench/api/node/extHostTypeConverters.ts index e16843c2412..3ee9ba84150 100644 --- a/src/vs/workbench/api/node/extHostTypeConverters.ts +++ b/src/vs/workbench/api/node/extHostTypeConverters.ts @@ -379,6 +379,7 @@ export namespace DocumentSymbol { export function from(info: vscode.DocumentSymbol): modes.DocumentSymbol { let result: modes.DocumentSymbol = { name: info.name, + detail: info.detail, fullRange: Range.from(info.fullRange), identifierRange: Range.from(info.gotoRange), kind: SymbolKind.from(info.kind) @@ -391,6 +392,7 @@ export namespace DocumentSymbol { export function to(info: modes.DocumentSymbol): vscode.DocumentSymbol { let result = new types.DocumentSymbol( info.name, + info.detail, SymbolKind.to(info.kind), Range.to(info.fullRange), Range.to(info.identifierRange), diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index 5f4e216580a..45d1aae95b7 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -883,17 +883,23 @@ export class SymbolInformation { export class DocumentSymbol { name: string; + detail: string; kind: SymbolKind; fullRange: Range; gotoRange: Range; children: DocumentSymbol[]; - constructor(name: string, kind: SymbolKind, fullRange: Range, gotoRange: Range) { + constructor(name: string, detail: string, kind: SymbolKind, fullRange: Range, gotoRange: Range) { this.name = name; + this.detail = detail; this.kind = kind; this.fullRange = fullRange; this.gotoRange = gotoRange; this.children = []; + + if (!this.fullRange.contains(this.gotoRange)) { + throw new Error('gotoRange must be contained in fullRange'); + } } } diff --git a/src/vs/workbench/parts/outline/test/electron-browser/outlineModel.test.ts b/src/vs/workbench/parts/outline/test/electron-browser/outlineModel.test.ts index b01fd933f91..2f5f81785fa 100644 --- a/src/vs/workbench/parts/outline/test/electron-browser/outlineModel.test.ts +++ b/src/vs/workbench/parts/outline/test/electron-browser/outlineModel.test.ts @@ -17,6 +17,7 @@ suite('OutlineModel', function () { function fakeSymbolInformation(range: Range, name: string = 'foo'): DocumentSymbol { return { name, + detail: 'fake', kind: SymbolKind.Boolean, identifierRange: range, fullRange: range