diff --git a/src/vs/workbench/services/path/common/remotePathService.ts b/src/vs/workbench/services/path/common/remotePathService.ts index 8fbdb80478d..a1e875a0e13 100644 --- a/src/vs/workbench/services/path/common/remotePathService.ts +++ b/src/vs/workbench/services/path/common/remotePathService.ts @@ -15,12 +15,29 @@ const REMOTE_PATH_SERVICE_ID = 'remotePath'; export const IRemotePathService = createDecorator(REMOTE_PATH_SERVICE_ID); export interface IRemotePathService { + _serviceBrand: undefined; + /** + * The path library to use for the target remote environment. + */ readonly path: Promise; + + /** + * Converts the given path to a file URI in the remote environment. + */ fileURI(path: string): Promise; + /** + * Resolves the user home of the remote environment if defined. + */ readonly userHome: Promise; + + /** + * Provides access to the user home of the remote environment + * if defined. + */ + readonly userHomeSync: URI | undefined; } /** @@ -30,12 +47,15 @@ export class RemotePathService implements IRemotePathService { _serviceBrand: undefined; private _extHostOS: Promise; + private _userHomeSync: URI | undefined; constructor( @IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService, @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService ) { this._extHostOS = remoteAgentService.getEnvironment().then(remoteEnvironment => { + this._userHomeSync = remoteEnvironment?.userHome; + return remoteEnvironment ? remoteEnvironment.os : platform.OS; }); } @@ -93,6 +113,10 @@ export class RemotePathService implements IRemotePathService { return this.environmentService.userHome!; }); } + + get userHomeSync(): URI | undefined { + return this._userHomeSync || this.environmentService.userHome; + } } registerSingleton(IRemotePathService, RemotePathService, true); diff --git a/src/vs/workbench/test/browser/workbenchTestServices.ts b/src/vs/workbench/test/browser/workbenchTestServices.ts index dd25a213031..bf6ee67f306 100644 --- a/src/vs/workbench/test/browser/workbenchTestServices.ts +++ b/src/vs/workbench/test/browser/workbenchTestServices.ts @@ -1110,6 +1110,7 @@ export class TestRemotePathService implements IRemotePathService { get path() { return Promise.resolve(isWindows ? win32 : posix); } get userHome() { return Promise.resolve(this.environmentService.userHome!); } + get userHomeSync() { return this.environmentService.userHome; } async fileURI(path: string): Promise { return URI.file(path);