44 *--------------------------------------------------------------------------------------------*/
55
66import { URI } from 'vs/base/common/uri' ;
7- import * as resources from 'vs/base/common/resources' ;
7+ import { posix } from 'vs/base/common/path' ;
8+ import { dirname , isEqual , basenameOrAuthority } from 'vs/base/common/resources' ;
89import { IconLabel , IIconLabelValueOptions , IIconLabelCreationOptions } from 'vs/base/browser/ui/iconLabel/iconLabel' ;
910import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions' ;
1011import { IModeService } from 'vs/editor/common/services/modeService' ;
@@ -323,7 +324,7 @@ class ResourceLabelWidget extends IconLabel {
323324 }
324325
325326 notifyUntitledLabelChange ( resource : URI ) : void {
326- if ( resources . isEqual ( resource , this . label ?. resource ) ) {
327+ if ( isEqual ( resource , this . label ?. resource ) ) {
327328 this . render ( false ) ;
328329 }
329330 }
@@ -340,13 +341,13 @@ class ResourceLabelWidget extends IconLabel {
340341 }
341342
342343 if ( ! name ) {
343- name = resources . basenameOrAuthority ( resource ) ;
344+ name = basenameOrAuthority ( resource ) ;
344345 }
345346 }
346347
347348 let description : string | undefined ;
348349 if ( ! options ?. hidePath ) {
349- description = this . labelService . getUriLabel ( resources . dirname ( resource ) , { relative : true } ) ;
350+ description = this . labelService . getUriLabel ( dirname ( resource ) , { relative : true } ) ;
350351 }
351352
352353 this . setResource ( { resource, name, description } , options ) ;
@@ -370,13 +371,15 @@ class ResourceLabelWidget extends IconLabel {
370371 if ( typeof label . description === 'string' ) {
371372 let untitledDescription : string ;
372373 if ( untitledModel . hasAssociatedFilePath ) {
373- untitledDescription = this . labelService . getUriLabel ( resources . dirname ( untitledModel . resource ) , { relative : true } ) ;
374+ untitledDescription = this . labelService . getUriLabel ( dirname ( untitledModel . resource ) , { relative : true } ) ;
374375 } else {
375376 untitledDescription = untitledModel . resource . path ;
376377 }
377378
378379 if ( label . name !== untitledDescription ) {
379380 label . description = untitledDescription ;
381+ } else if ( label . description === posix . sep ) {
382+ label . description = undefined ; // unset showing just "/" for untitled without associated resource
380383 }
381384 }
382385 }
0 commit comments