-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #469 from CodinGame/wait-workspace-initialization
Wait for workspace to be ready
- Loading branch information
Showing
2 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?Lo=C3=AFc=20Mangeonjean?= <[email protected]> | ||
Date: Wed, 17 Jul 2024 11:57:07 +0200 | ||
Subject: [PATCH] fix: wait workspace to be ready | ||
|
||
--- | ||
src/vs/workbench/services/path/browser/pathService.ts | 4 ++-- | ||
src/vs/workbench/services/path/common/pathService.ts | 4 ++-- | ||
.../workbench/services/path/electron-sandbox/pathService.ts | 2 +- | ||
3 files changed, 5 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/src/vs/workbench/services/path/browser/pathService.ts b/src/vs/workbench/services/path/browser/pathService.ts | ||
index 2457dbaa576..9f5f8d6aa2b 100644 | ||
--- a/src/vs/workbench/services/path/browser/pathService.ts | ||
+++ b/src/vs/workbench/services/path/browser/pathService.ts | ||
@@ -28,14 +28,14 @@ export class BrowserPathService extends AbstractPathService { | ||
} | ||
} | ||
|
||
-export function guessLocalUserHome(environmentService: IWorkbenchEnvironmentService, contextService: IWorkspaceContextService): URI { | ||
+export async function guessLocalUserHome(environmentService: IWorkbenchEnvironmentService, contextService: IWorkspaceContextService): Promise<URI> { | ||
|
||
// In web we do not really have the concept of a "local" user home | ||
// but we still require it in many places as a fallback. As such, | ||
// we have to come up with a synthetic location derived from the | ||
// environment. | ||
|
||
- const workspace = contextService.getWorkspace(); | ||
+ const workspace = await contextService.getCompleteWorkspace(); | ||
|
||
const firstFolder = firstOrDefault(workspace.folders); | ||
if (firstFolder) { | ||
diff --git a/src/vs/workbench/services/path/common/pathService.ts b/src/vs/workbench/services/path/common/pathService.ts | ||
index 83baa4126b0..6a6324c5a1f 100644 | ||
--- a/src/vs/workbench/services/path/common/pathService.ts | ||
+++ b/src/vs/workbench/services/path/common/pathService.ts | ||
@@ -88,7 +88,7 @@ export abstract class AbstractPathService implements IPathService { | ||
private maybeUnresolvedUserHome: URI | undefined; | ||
|
||
constructor( | ||
- private localUserHome: URI, | ||
+ private localUserHome: Promise<URI>, | ||
@IRemoteAgentService private readonly remoteAgentService: IRemoteAgentService, | ||
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, | ||
@IWorkspaceContextService private contextService: IWorkspaceContextService | ||
@@ -104,7 +104,7 @@ export abstract class AbstractPathService implements IPathService { | ||
// User Home | ||
this.resolveUserHome = (async () => { | ||
const env = await this.remoteAgentService.getEnvironment(); | ||
- const userHome = this.maybeUnresolvedUserHome = env?.userHome ?? localUserHome; | ||
+ const userHome = this.maybeUnresolvedUserHome = env?.userHome ?? await localUserHome; | ||
|
||
return userHome; | ||
})(); | ||
diff --git a/src/vs/workbench/services/path/electron-sandbox/pathService.ts b/src/vs/workbench/services/path/electron-sandbox/pathService.ts | ||
index 7888fc6ab71..9f5e122ca05 100644 | ||
--- a/src/vs/workbench/services/path/electron-sandbox/pathService.ts | ||
+++ b/src/vs/workbench/services/path/electron-sandbox/pathService.ts | ||
@@ -16,7 +16,7 @@ export class NativePathService extends AbstractPathService { | ||
@INativeWorkbenchEnvironmentService environmentService: INativeWorkbenchEnvironmentService, | ||
@IWorkspaceContextService contextService: IWorkspaceContextService | ||
) { | ||
- super(environmentService.userHome, remoteAgentService, environmentService, contextService); | ||
+ super(Promise.resolve(environmentService.userHome), remoteAgentService, environmentService, contextService); | ||
} | ||
} | ||
|
f40ad22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Published on https://monaco-vscode-api.netlify.app as production
🚀 Deployed on https://6697baf7bd80c10ad8ffb16b--monaco-vscode-api.netlify.app