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

Fix 'Close Workspace' #3386

Merged
merged 1 commit into from
Nov 5, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export class WorkspaceFrontendContribution implements CommandContribution, Keybi
msg: 'Do you really want to close the workspace?'
});
if (await dialog.open()) {
this.workspaceService.close();
await this.workspaceService.close();
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/workspace/src/browser/workspace-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,11 @@ export class WorkspaceService implements FrontendApplicationContribution {
/**
* Clears current workspace root.
*/
close(): void {
async close(): Promise<void> {
this._workspace = undefined;
this._roots.length = 0;

this.server.setMostRecentlyUsedWorkspace('');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could talk on Monday in person. Like Simon, I don't really understand the difference.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to make sure to await the call this.server.setMostRecentlyUsedWorkspace('') in order for the backend to properly finish updating before Theia can reload. What I noticed in Firefox for example is that the update never resolves so when Theia reloads it reloads with the workspace that was opened before the Close Workspace was called.

await this.server.setMostRecentlyUsedWorkspace('');
simark marked this conversation as resolved.
Show resolved Hide resolved
this.reloadWindow();
}

Expand Down