Skip to content

Commit 5601642

Browse files
author
Benjamin Pasero
committed
Untitled files show up with "/" as description in some places (fixes microsoft#29936)
1 parent 98bac76 commit 5601642

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/vs/workbench/browser/labels.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
1919
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
2020
import { IModelService } from 'vs/editor/common/services/modelService';
2121
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
22+
import { IUntitledEditorService } from "vs/workbench/services/untitled/common/untitledEditorService";
23+
import { Schemas } from "vs/base/common/network";
2224

2325
export interface IEditorLabel {
2426
name: string;
@@ -169,11 +171,27 @@ export interface IFileLabelOptions extends IResourceLabelOptions {
169171

170172
export class FileLabel extends ResourceLabel {
171173

174+
constructor(
175+
container: HTMLElement,
176+
options: IIconLabelCreationOptions,
177+
@IExtensionService extensionService: IExtensionService,
178+
@IWorkspaceContextService contextService: IWorkspaceContextService,
179+
@IConfigurationService configurationService: IConfigurationService,
180+
@IModeService modeService: IModeService,
181+
@IModelService modelService: IModelService,
182+
@IEnvironmentService environmentService: IEnvironmentService,
183+
@IUntitledEditorService private untitledEditorService: IUntitledEditorService
184+
) {
185+
super(container, options, extensionService, contextService, configurationService, modeService, modelService, environmentService);
186+
}
187+
172188
public setFile(resource: uri, options: IFileLabelOptions = Object.create(null)): void {
189+
const hidePath = options.hidePath || (resource.scheme === Schemas.untitled && !this.untitledEditorService.hasAssociatedFilePath(resource));
190+
173191
this.setLabel({
174192
resource,
175193
name: !options.hideLabel ? paths.basename(resource.fsPath) : void 0,
176-
description: !options.hidePath ? getPathLabel(paths.dirname(resource.fsPath), this.contextService, this.environmentService) : void 0
194+
description: !hidePath ? getPathLabel(paths.dirname(resource.fsPath), this.contextService, this.environmentService) : void 0
177195
}, options);
178196
}
179197
}

0 commit comments

Comments
 (0)