@@ -10,31 +10,31 @@ import { URI } from 'vs/base/common/uri';
1010import { Schemas } from 'vs/base/common/network' ;
1111import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService' ;
1212import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
13- import { memoize } from 'vs/base/common/decorators' ;
1413
1514export class BrowserPathService extends AbstractPathService {
1615
16+ readonly defaultUriScheme = defaultUriScheme ( this . environmentService , this . contextService ) ;
17+
1718 constructor (
1819 @IRemoteAgentService remoteAgentService : IRemoteAgentService ,
1920 @IWorkbenchEnvironmentService private readonly environmentService : IWorkbenchEnvironmentService ,
2021 @IWorkspaceContextService private readonly contextService : IWorkspaceContextService
2122 ) {
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 ) ;
2324 }
25+ }
2426
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+ }
3531
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.' ) ;
3735 }
36+
37+ return firstFolder . uri . scheme ;
3838}
3939
4040registerSingleton ( IPathService , BrowserPathService , true ) ;
0 commit comments