mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
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:
parent
405271c17d
commit
17004573e3
|
@ -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;
|
||||
|
|
|
@ -288,7 +288,7 @@ export class EditorQuickOpenEntry extends QuickOpenEntry implements IEditorQuick
|
|||
*/
|
||||
export class EditorQuickOpenEntryGroup extends QuickOpenEntryGroup implements IEditorQuickOpenEntry {
|
||||
|
||||
public getInput(): IEditorInput {
|
||||
public getInput(): IEditorInput | IResourceInput {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
|
|||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IWorkspaceSymbolProvider, getWorkspaceSymbols } from 'vs/workbench/parts/search/common/search';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { basename } from 'vs/base/common/paths';
|
||||
|
||||
class SymbolEntry extends EditorQuickOpenEntry {
|
||||
|
||||
|
@ -50,11 +51,15 @@ class SymbolEntry extends EditorQuickOpenEntry {
|
|||
}
|
||||
|
||||
public getDescription(): string {
|
||||
let result = this._bearing.containerName;
|
||||
if (!result && this._bearing.location.uri) {
|
||||
result = labels.getPathLabel(this._bearing.location.uri, this._contextService, this._environmentService);
|
||||
const containerName = this._bearing.containerName;
|
||||
if (this._bearing.location.uri) {
|
||||
if (containerName) {
|
||||
return `${containerName} — ${basename(this._bearing.location.uri.fsPath)}`;
|
||||
} else {
|
||||
return labels.getPathLabel(this._bearing.location.uri, this._contextService, this._environmentService);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return containerName;
|
||||
}
|
||||
|
||||
public getIcon(): string {
|
||||
|
|
Loading…
Reference in a new issue