From 87dc2641934310444207834c781177582ae8fed7 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Thu, 2 Feb 2017 16:40:33 -0800 Subject: [PATCH] Don't show anon functions/classes in TS document symbol list. Fixes #18698 --- .../src/features/documentSymbolProvider.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/extensions/typescript/src/features/documentSymbolProvider.ts b/extensions/typescript/src/features/documentSymbolProvider.ts index 62e58a51fc7..5d4a8595a37 100644 --- a/extensions/typescript/src/features/documentSymbolProvider.ts +++ b/extensions/typescript/src/features/documentSymbolProvider.ts @@ -74,10 +74,11 @@ export default class TypeScriptDocumentSymbolProvider implements DocumentSymbolP } } + private static convertNavBar(resource: Uri, indent: number, foldingMap: ObjectMap, bucket: SymbolInformation[], item: Proto.NavigationBarItem, containerLabel?: string): void { let realIndent = indent + item.indent; let key = `${realIndent}|${item.text}`; - if (realIndent !== 0 && !foldingMap[key]) { + if (realIndent !== 0 && !foldingMap[key] && TypeScriptDocumentSymbolProvider.shouldInclueEntry(item.text)) { let result = new SymbolInformation(item.text, outlineTypeTable[item.kind] || SymbolKind.Variable, containerLabel ? containerLabel : '', @@ -103,6 +104,13 @@ export default class TypeScriptDocumentSymbolProvider implements DocumentSymbolP TypeScriptDocumentSymbolProvider.convertNavTree(resource, bucket, child, result.name); } } - bucket.push(result); + + if (TypeScriptDocumentSymbolProvider.shouldInclueEntry(result.name)) { + bucket.push(result); + } + } + + private static shouldInclueEntry(name: string): boolean { + return !!(name && name !== '' && name !== ''); } } \ No newline at end of file -- GitLab