Skip to content

Commit

Permalink
Fix 'Open Recent Workspace' command and menu item
Browse files Browse the repository at this point in the history
Fixes #3421

Signed-off-by: Vincent Fugnitto <vincent.fugnitto@ericsson.com>
  • Loading branch information
vince-fugnitto committed Nov 7, 2018
1 parent f37496b commit 19e9136
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 6 additions & 0 deletions packages/workspace/src/browser/quick-open-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ export class QuickOpenWorkspace implements QuickOpenModel {
tempWorkspaceFile = getTemporaryWorkspaceFileUri(new URI(home));
}
await this.preferences.ready;
if (!workspaces.length) {
this.items.push(new QuickOpenGroupItem({
label: 'No Recent Workspaces',
run: (mode: QuickOpenMode): boolean => false
}));
}
for (const workspace of workspaces) {
const uri = new URI(workspace);
const stat = await this.fileSystem.getFileStat(workspace);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,8 @@ export class WorkspaceFrontendContribution implements CommandContribution, Keybi
isEnabled: () => this.workspaceService.opened,
execute: () => this.closeWorkspace()
});
this.workspaceService.recentWorkspaces().then(({ length }) => {
if (!length) {
commands.registerCommand(WorkspaceCommands.OPEN_RECENT_WORKSPACE, {
execute: () => this.quickOpenWorkspace.select()
});
}
commands.registerCommand(WorkspaceCommands.OPEN_RECENT_WORKSPACE, {
execute: () => this.quickOpenWorkspace.select()
});
commands.registerCommand(WorkspaceCommands.SAVE_WORKSPACE_AS, {
isEnabled: () => this.workspaceService.isMultiRootWorkspaceOpened,
Expand Down

0 comments on commit 19e9136

Please sign in to comment.