@@ -10,31 +10,31 @@ import { URI } from 'vs/base/common/uri';
10
10
import { Schemas } from 'vs/base/common/network' ;
11
11
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService' ;
12
12
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
13
- import { memoize } from 'vs/base/common/decorators' ;
14
13
15
14
export class BrowserPathService extends AbstractPathService {
16
15
16
+ readonly defaultUriScheme = defaultUriScheme ( this . environmentService , this . contextService ) ;
17
+
17
18
constructor (
18
19
@IRemoteAgentService remoteAgentService : IRemoteAgentService ,
19
20
@IWorkbenchEnvironmentService private readonly environmentService : IWorkbenchEnvironmentService ,
20
21
@IWorkspaceContextService private readonly contextService : IWorkspaceContextService
21
22
) {
22
- super ( URI . from ( { scheme : Schemas . vscodeRemote , authority : environmentService . configuration . remoteAuthority , path : '/' } ) , remoteAgentService ) ;
23
+ super ( URI . from ( { scheme : defaultUriScheme ( environmentService , contextService ) , authority : environmentService . configuration . remoteAuthority , path : '/' } ) , remoteAgentService ) ;
23
24
}
25
+ }
24
26
25
- @memoize
26
- get defaultUriScheme ( ) : string {
27
- if ( this . environmentService . configuration . remoteAuthority ) {
28
- return Schemas . vscodeRemote ;
29
- }
30
-
31
- const firstFolder = this . contextService . getWorkspace ( ) . folders [ 0 ] ;
32
- if ( ! firstFolder ) {
33
- throw new Error ( 'Empty workspace is not supported in browser when there is no remote connection.' ) ;
34
- }
27
+ function defaultUriScheme ( environmentService : IWorkbenchEnvironmentService , contextService : IWorkspaceContextService ) : string {
28
+ if ( environmentService . configuration . remoteAuthority ) {
29
+ return Schemas . vscodeRemote ;
30
+ }
35
31
36
- return firstFolder . uri . scheme ;
32
+ const firstFolder = contextService . getWorkspace ( ) . folders [ 0 ] ;
33
+ if ( ! firstFolder ) {
34
+ throw new Error ( 'Empty workspace is not supported in browser when there is no remote connection.' ) ;
37
35
}
36
+
37
+ return firstFolder . uri . scheme ;
38
38
}
39
39
40
40
registerSingleton ( IPathService , BrowserPathService , true ) ;
0 commit comments