Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait for workspace to be ready #469

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/service-override/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BrowserPathServiceOverride extends AbstractPathService {
@IWorkspaceContextService contextService: IWorkspaceContextService
) {
super(
getEnvironmentOverride().userHome ?? guessLocalUserHome(environmentService, contextService),
Promise.resolve(getEnvironmentOverride().userHome ?? guessLocalUserHome(environmentService, contextService)),
remoteAgentService,
environmentService,
contextService
Expand Down
67 changes: 67 additions & 0 deletions vscode-paches/0057-fix-wait-workspace-to-be-ready.patch
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);
}
}