Skip to content

Commit b1b5b8a

Browse files
committed
debt - adopt defaultUriScheme also for userHome
1 parent e37e0ff commit b1b5b8a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/vs/workbench/services/path/browser/pathService.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,31 @@ import { URI } from 'vs/base/common/uri';
1010
import { Schemas } from 'vs/base/common/network';
1111
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
1212
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
13-
import { memoize } from 'vs/base/common/decorators';
1413

1514
export 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

4040
registerSingleton(IPathService, BrowserPathService, true);

0 commit comments

Comments
 (0)