Always Show File Names in Symbol Search Results (#26518)

* Fixes #26370

Updates the symbol search results to always display the filename. This feature was previously added to the TS extension specifically, so this change removes that work in favor of a change to the core symbol search experience

* Use dash with filename
This commit is contained in:
Matt Bierner
2017-05-16 17:00:43 -07:00
committed by GitHub
parent 405271c17d
commit 17004573e3
3 changed files with 12 additions and 18 deletions

View File

@@ -7,8 +7,6 @@
import { workspace, window, Uri, WorkspaceSymbolProvider, SymbolInformation, SymbolKind, Range, Location, CancellationToken } from 'vscode';
import * as path from 'path';
import * as Proto from '../protocol';
import { ITypescriptServiceClient } from '../typescriptService';
@@ -76,17 +74,8 @@ export default class TypeScriptWorkspaceSymbolProvider implements WorkspaceSymbo
if (item.kind === 'method' || item.kind === 'function') {
label += '()';
}
const containerNameParts: string[] = [];
if (item.containerName) {
containerNameParts.push(item.containerName);
}
const fileUri = this.client.asUrl(item.file);
const fileName = path.basename(fileUri.fsPath);
if (fileName) {
containerNameParts.push(fileName);
}
result.push(new SymbolInformation(label, getSymbolKind(item), containerNameParts.join(' — '),
new Location(fileUri, range)));
result.push(new SymbolInformation(label, getSymbolKind(item), item.containerName || '',
new Location(this.client.asUrl(item.file), range)));
}
}
return result;