@@ -7,38 +7,32 @@ import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as
77import { Registry } from 'vs/platform/registry/common/platform' ;
88import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle' ;
99import { ILabelService } from 'vs/platform/label/common/label' ;
10- import { isWeb } from 'vs/base/common/platform' ;
10+ import { isWeb , OperatingSystem } from 'vs/base/common/platform' ;
1111import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService' ;
1212import { Schemas } from 'vs/base/common/network' ;
13+ import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService' ;
1314
1415export class LabelContribution implements IWorkbenchContribution {
1516 constructor (
1617 @ILabelService private readonly labelService : ILabelService ,
17- @IWorkbenchEnvironmentService private readonly environmentService : IWorkbenchEnvironmentService ) {
18+ @IWorkbenchEnvironmentService private readonly environmentService : IWorkbenchEnvironmentService ,
19+ @IRemoteAgentService private readonly remoteAgentService : IRemoteAgentService ) {
1820 this . registerFormatters ( ) ;
1921 }
2022
21- private useWindowsPaths ( ) : boolean {
22- if ( this . environmentService . configuration . folderUri ) {
23- return this . environmentService . configuration . folderUri . fsPath . indexOf ( '/' ) === - 1 ;
24- }
25-
26- if ( this . environmentService . configuration . workspace ) {
27- return this . environmentService . configuration . workspace . configPath . fsPath . indexOf ( '/' ) === - 1 ;
28- }
29-
30- return false ;
31- }
32-
3323 private registerFormatters ( ) : void {
3424 if ( isWeb ) {
35- this . labelService . registerFormatter ( {
36- scheme : Schemas . vscodeRemote ,
37- authority : this . environmentService . configuration . remoteAuthority ,
38- formatting : {
39- label : '${path}' ,
40- separator : this . useWindowsPaths ( ) ? '\\' : '/' ,
41- tildify : ! this . useWindowsPaths ( )
25+ this . remoteAgentService . getEnvironment ( ) . then ( remoteEnvironment => {
26+ if ( remoteEnvironment ) {
27+ this . labelService . registerFormatter ( {
28+ scheme : Schemas . vscodeRemote ,
29+ authority : this . environmentService . configuration . remoteAuthority ,
30+ formatting : {
31+ label : '${path}' ,
32+ separator : remoteEnvironment . os === OperatingSystem . Windows ? '\\' : '/' ,
33+ tildify : remoteEnvironment . os !== OperatingSystem . Windows
34+ }
35+ } ) ;
4236 }
4337 } ) ;
4438 }
0 commit comments