From 19e9136faba4cdb1896402f18f8d2a7be7482ffc Mon Sep 17 00:00:00 2001 From: Vincent Fugnitto Date: Wed, 7 Nov 2018 10:40:39 -0500 Subject: [PATCH] Fix 'Open Recent Workspace' command and menu item Fixes #3421 Signed-off-by: Vincent Fugnitto --- packages/workspace/src/browser/quick-open-workspace.ts | 6 ++++++ .../src/browser/workspace-frontend-contribution.ts | 8 ++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/workspace/src/browser/quick-open-workspace.ts b/packages/workspace/src/browser/quick-open-workspace.ts index 5147a5fc27cdd..f28c3e4a2db70 100644 --- a/packages/workspace/src/browser/quick-open-workspace.ts +++ b/packages/workspace/src/browser/quick-open-workspace.ts @@ -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); diff --git a/packages/workspace/src/browser/workspace-frontend-contribution.ts b/packages/workspace/src/browser/workspace-frontend-contribution.ts index eff12355b91d3..3662b0aaf2a39 100644 --- a/packages/workspace/src/browser/workspace-frontend-contribution.ts +++ b/packages/workspace/src/browser/workspace-frontend-contribution.ts @@ -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,