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
10 changes: 5 additions & 5 deletions packages/workspace/src/browser/workspace-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ export class WorkspaceService implements FrontendApplicationContribution {
if (preserveWindow) {
this._workspace = stat;
}
this.openWindow(stat, { preserveWindow });
this.openWindow(stat, Object.assign(options ?? {}, { preserveWindow }));
return;
}
throw new Error('Invalid workspace root URI. Expected an existing directory or workspace file.');
Expand Down Expand Up @@ -497,10 +497,10 @@ export class WorkspaceService implements FrontendApplicationContribution {
const workspacePath = uri.resource.path.toString();

if (this.shouldPreserveWindow(options)) {
this.reloadWindow();
this.reloadWindow(options);
} else {
try {
this.openNewWindow(workspacePath);
this.openNewWindow(workspacePath, options);
} catch (error) {
// Fall back to reloading the current window in case the browser has blocked the new window
this._workspace = uri;
Expand All @@ -509,7 +509,7 @@ export class WorkspaceService implements FrontendApplicationContribution {
}
}

protected reloadWindow(): void {
protected reloadWindow(options?: WorkspaceInput): void {
// Set the new workspace path as the URL fragment.
if (this._workspace !== undefined) {
this.setURLFragment(this._workspace.resource.path.toString());
Expand All @@ -520,7 +520,7 @@ export class WorkspaceService implements FrontendApplicationContribution {
this.windowService.reload();
}

protected openNewWindow(workspacePath: string): void {
protected openNewWindow(workspacePath: string, options?: WorkspaceInput): void {
const url = new URL(window.location.href);
url.hash = encodeURI(workspacePath);
this.windowService.openNewWindow(url.toString());
Expand Down