Skip to content
Merged
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
27 changes: 19 additions & 8 deletions patches/local-storage.diff
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ IndexedDB and does not appear nearly as easy to redirect to disk.
To test change settings from the UI and on disk while making sure they appear on
the other side.

This patch also resolves a bug where a global value for workspace initialization
is used in a non async-safe way.
When opening a remote workspace for the first time, the server can finish reading
its workspace file after the browser creates an empty cached workspace but before
it assigns that workspace. Use the loaded configuration at assignment so Explorer
shows the folders listed in the file.

Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
===================================================================
Expand Down Expand Up @@ -79,15 +81,24 @@ Index: code-server/lib/vscode/src/vs/workbench/services/configuration/browser/co
});
}));

@@ -574,6 +576,12 @@ export class WorkspaceService extends Di
@@ -535,6 +537,10 @@ export class WorkspaceService extends Di

private async createMultiFolderWorkspace(workspaceIdentifier: IWorkspaceIdentifier): Promise<Workspace> {
await this.workspaceConfiguration.initialize({ id: workspaceIdentifier.id, configPath: workspaceIdentifier.configPath }, this.isWorkspaceTrusted);
+ return this.workspaceFromConfiguration(workspaceIdentifier);
+ }
+
+ private workspaceFromConfiguration(workspaceIdentifier: IWorkspaceIdentifier): Workspace {
const workspaceConfigPath = workspaceIdentifier.configPath;
const workspaceFolders = toWorkspaceFolders(this.workspaceConfiguration.getFolders(), workspaceConfigPath, this.uriIdentityService.extUri);
const workspaceId = workspaceIdentifier.id;
@@ -574,6 +580,10 @@ export class WorkspaceService extends Di
previousFolders = this.workspace.folders;
this.workspace.update(workspace);
} else {
+ // It is possible for the configuration to become initialized in between
+ // when the workspace was created and this function was called, so check
+ // the configuration again now.
+ if (!workspace.initialized && this.workspaceConfiguration.initialized) {
+ workspace.initialized = true;
+ // The live configuration may have replaced the cache after this workspace was created.
+ if (!workspace.initialized && workspace.configuration && this.workspaceConfiguration.initialized) {
+ workspace = this.workspaceFromConfiguration({ id: workspace.id, configPath: workspace.configuration });
+ }
this.workspace = workspace;
}
Expand Down