@@ -18,6 +18,8 @@ import { localize } from 'vs/nls';
1818import { isParent } from 'vs/platform/files/common/files' ;
1919import { basename , dirname , join } from 'vs/base/common/paths' ;
2020import { Schemas } from 'vs/base/common/network' ;
21+ import { IWindowService } from 'vs/platform/windows/common/windows' ;
22+ import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts' ;
2123
2224export interface RegisterFormatterEvent {
2325 selector : string ;
@@ -33,6 +35,7 @@ export interface ILabelService {
3335 */
3436 getUriLabel ( resource : URI , options ?: { relative ?: boolean , noPrefix ?: boolean } ) : string ;
3537 getWorkspaceLabel ( workspace : ( IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IWorkspace ) , options ?: { verbose : boolean } ) : string ;
38+ getHostLabel ( ) : string ;
3639 registerFormatter ( selector : string , formatter : LabelRules ) : IDisposable ;
3740 onDidRegisterFormatter : Event < RegisterFormatterEvent > ;
3841}
@@ -66,7 +69,8 @@ export class LabelService implements ILabelService {
6669
6770 constructor (
6871 @IEnvironmentService private environmentService : IEnvironmentService ,
69- @IWorkspaceContextService private contextService : IWorkspaceContextService
72+ @IWorkspaceContextService private contextService : IWorkspaceContextService ,
73+ @IWindowService private windowService : IWindowService
7074 ) { }
7175
7276 get onDidRegisterFormatter ( ) : Event < RegisterFormatterEvent > {
@@ -155,6 +159,19 @@ export class LabelService implements ILabelService {
155159 return localize ( 'workspaceName' , "{0} (Workspace)" , workspaceName ) ;
156160 }
157161
162+ getHostLabel ( ) : string {
163+ if ( this . windowService ) {
164+ const authority = this . windowService . getConfiguration ( ) . remoteAuthority ;
165+ if ( authority ) {
166+ const formatter = this . findFormatter ( URI . from ( { scheme : REMOTE_HOST_SCHEME , authority } ) ) ;
167+ if ( formatter && formatter . workspace ) {
168+ return formatter . workspace . suffix ;
169+ }
170+ }
171+ }
172+ return '' ;
173+ }
174+
158175 registerFormatter ( selector : string , formatter : LabelRules ) : IDisposable {
159176 this . formatters [ selector ] = formatter ;
160177 this . _onDidRegisterFormatter . fire ( { selector, formatter } ) ;
0 commit comments