mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 04:23:32 +01:00
Untitled files show up with "/" as description in some places (fixes #29936)
This commit is contained in:
@@ -19,6 +19,8 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IUntitledEditorService } from "vs/workbench/services/untitled/common/untitledEditorService";
|
||||
import { Schemas } from "vs/base/common/network";
|
||||
|
||||
export interface IEditorLabel {
|
||||
name: string;
|
||||
@@ -169,11 +171,27 @@ export interface IFileLabelOptions extends IResourceLabelOptions {
|
||||
|
||||
export class FileLabel extends ResourceLabel {
|
||||
|
||||
constructor(
|
||||
container: HTMLElement,
|
||||
options: IIconLabelCreationOptions,
|
||||
@IExtensionService extensionService: IExtensionService,
|
||||
@IWorkspaceContextService contextService: IWorkspaceContextService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IModeService modeService: IModeService,
|
||||
@IModelService modelService: IModelService,
|
||||
@IEnvironmentService environmentService: IEnvironmentService,
|
||||
@IUntitledEditorService private untitledEditorService: IUntitledEditorService
|
||||
) {
|
||||
super(container, options, extensionService, contextService, configurationService, modeService, modelService, environmentService);
|
||||
}
|
||||
|
||||
public setFile(resource: uri, options: IFileLabelOptions = Object.create(null)): void {
|
||||
const hidePath = options.hidePath || (resource.scheme === Schemas.untitled && !this.untitledEditorService.hasAssociatedFilePath(resource));
|
||||
|
||||
this.setLabel({
|
||||
resource,
|
||||
name: !options.hideLabel ? paths.basename(resource.fsPath) : void 0,
|
||||
description: !options.hidePath ? getPathLabel(paths.dirname(resource.fsPath), this.contextService, this.environmentService) : void 0
|
||||
description: !hidePath ? getPathLabel(paths.dirname(resource.fsPath), this.contextService, this.environmentService) : void 0
|
||||
}, options);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user