diff --git a/src/vs/workbench/electron-browser/actions.ts b/src/vs/workbench/electron-browser/actions.ts index 1a46f41e86e..8dfc51ea8d1 100644 --- a/src/vs/workbench/electron-browser/actions.ts +++ b/src/vs/workbench/electron-browser/actions.ts @@ -753,11 +753,23 @@ export abstract class BaseOpenRecentAction extends Action { const workspacePicks: IFilePickOpenEntry[] = recentWorkspaces.map((workspace, index) => toPick(workspace, index === 0 ? { label: nls.localize('workspaces', "workspaces") } : void 0, isSingleFolderWorkspaceIdentifier(workspace) ? FileKind.FOLDER : FileKind.ROOT_FOLDER, this.environmentService, !this.isQuickNavigate() ? this.removeAction : void 0)); const filePicks: IFilePickOpenEntry[] = recentFiles.map((p, index) => toPick(p, index === 0 ? { label: nls.localize('files', "files"), border: true } : void 0, FileKind.FILE, this.environmentService, !this.isQuickNavigate() ? this.removeAction : void 0)); - const hasWorkspace = this.contextService.hasWorkspace(); + let isCurrentWorkspaceInList: boolean; + if (!this.contextService.hasWorkspace()) { + isCurrentWorkspaceInList = false; // we never show empty workspaces + } else if (this.contextService.hasFolderWorkspace()) { + isCurrentWorkspaceInList = true; // we always show folder workspaces + } else { + const firstWorkspace = recentWorkspaces[0]; + if (firstWorkspace && !isSingleFolderWorkspaceIdentifier(firstWorkspace)) { + isCurrentWorkspaceInList = firstWorkspace.id === this.contextService.getWorkspace().id; + } else { + isCurrentWorkspaceInList = false; // this is an untitled workspace thereby + } + } this.quickOpenService.pick([...workspacePicks, ...filePicks], { contextKey: inRecentFilesPickerContextKey, - autoFocus: { autoFocusFirstEntry: !hasWorkspace, autoFocusSecondEntry: hasWorkspace }, + autoFocus: { autoFocusFirstEntry: !isCurrentWorkspaceInList, autoFocusSecondEntry: isCurrentWorkspaceInList }, placeHolder: isMacintosh ? nls.localize('openRecentPlaceHolderMac', "Select to open (hold Cmd-key to open in new window)") : nls.localize('openRecentPlaceHolder', "Select to open (hold Ctrl-key to open in new window)"), matchOnDescription: true, quickNavigateConfiguration: this.isQuickNavigate() ? { keybindings: this.keybindingService.lookupKeybindings(this.id) } : void 0