@@ -19,6 +19,8 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
1919import { IDisposable , dispose } from 'vs/base/common/lifecycle' ;
2020import { IModelService } from 'vs/editor/common/services/modelService' ;
2121import { 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
2325export interface IEditorLabel {
2426 name : string ;
@@ -169,11 +171,27 @@ export interface IFileLabelOptions extends IResourceLabelOptions {
169171
170172export 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