@@ -12,7 +12,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
1212import { IEnvironmentService } from 'vs/platform/environment/common/environment' ;
1313import { IWorkspaceContextService , IWorkspace } from 'vs/platform/workspace/common/workspace' ;
1414import { isEqual , basenameOrAuthority , isEqualOrParent , basename , joinPath , dirname } from 'vs/base/common/resources' ;
15- import { isLinux , isWindows } from 'vs/base/common/platform' ;
15+ import { isWindows } from 'vs/base/common/platform' ;
1616import { tildify , getPathLabel } from 'vs/base/common/labels' ;
1717import { ltrim , endsWith } from 'vs/base/common/strings' ;
1818import { IWorkspaceIdentifier , ISingleFolderWorkspaceIdentifier , isSingleFolderWorkspaceIdentifier , WORKSPACE_EXTENSION , toWorkspaceIdentifier , isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces' ;
@@ -137,7 +137,7 @@ export class LabelService implements ILabelService {
137137
138138 if ( options . relative && baseResource ) {
139139 let relativeLabel : string ;
140- if ( isEqual ( baseResource . uri , resource , ! isLinux ) ) {
140+ if ( isEqual ( baseResource . uri , resource ) ) {
141141 relativeLabel = '' ; // no label if resources are identical
142142 } else {
143143 const baseResourceLabel = this . formatUri ( baseResource . uri , formatting , options . noPrefix ) ;
@@ -172,13 +172,7 @@ export class LabelService implements ILabelService {
172172 if ( isSingleFolderWorkspaceIdentifier ( workspace ) ) {
173173 // Folder on disk
174174 const label = options && options . verbose ? this . getUriLabel ( workspace ) : basename ( workspace ) || '/' ;
175- if ( workspace . scheme === Schemas . file ) {
176- return label ;
177- }
178-
179- const formatting = this . findFormatting ( workspace ) ;
180- const suffix = formatting && ( typeof formatting . workspaceSuffix === 'string' ) ? formatting . workspaceSuffix : workspace . scheme ;
181- return suffix ? `${ label } (${ suffix } )` : label ;
175+ return this . appendWorkspaceSuffix ( label , workspace ) ;
182176 }
183177
184178 // Workspace: Untitled
@@ -189,11 +183,13 @@ export class LabelService implements ILabelService {
189183 // Workspace: Saved
190184 const filename = basename ( workspace . configPath ) ;
191185 const workspaceName = filename . substr ( 0 , filename . length - WORKSPACE_EXTENSION . length - 1 ) ;
186+ let label ;
192187 if ( options && options . verbose ) {
193- return localize ( 'workspaceNameVerbose' , "{0} (Workspace)" , this . getUriLabel ( joinPath ( dirname ( workspace . configPath ) , workspaceName ) ) ) ;
188+ label = localize ( 'workspaceNameVerbose' , "{0} (Workspace)" , this . getUriLabel ( joinPath ( dirname ( workspace . configPath ) , workspaceName ) ) ) ;
189+ } else {
190+ label = localize ( 'workspaceName' , "{0} (Workspace)" , workspaceName ) ;
194191 }
195-
196- return localize ( 'workspaceName' , "{0} (Workspace)" , workspaceName ) ;
192+ return this . appendWorkspaceSuffix ( label , workspace . configPath ) ;
197193 }
198194
199195 getSeparator ( scheme : string , authority ?: string ) : '/' | '\\' {
@@ -250,4 +246,14 @@ export class LabelService implements ILabelService {
250246 }
251247 return appendedLabel ;
252248 }
249+
250+ private appendWorkspaceSuffix ( label : string , uri : URI ) : string {
251+ if ( uri . scheme === Schemas . file ) {
252+ return label ;
253+ }
254+
255+ const formatting = this . findFormatting ( uri ) ;
256+ const suffix = formatting && ( typeof formatting . workspaceSuffix === 'string' ) ? formatting . workspaceSuffix : uri . scheme ;
257+ return suffix ? `${ label } (${ suffix } )` : label ;
258+ }
253259}
0 commit comments