提交 56016425 编写于 作者: B Benjamin Pasero

Untitled files show up with "/" as description in some places (fixes #29936)

上级 98bac768
......@@ -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);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册