From 19500141cea548d06ac3247552a8519963ce32e2 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 26 Sep 2018 09:40:41 +0200 Subject: [PATCH] fix #35935 --- src/vs/code/electron-main/menus.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/vs/code/electron-main/menus.ts b/src/vs/code/electron-main/menus.ts index 90a28a1e3ff..4531a0ed648 100644 --- a/src/vs/code/electron-main/menus.ts +++ b/src/vs/code/electron-main/menus.ts @@ -467,10 +467,20 @@ export class CodeMenu { } if (workspaces.length || files.length) { + const hasNoWindows = (this.windowsMainService.getWindowCount() === 0); + openRecentMenu.append(__separator__()); openRecentMenu.append(this.createMenuItem(nls.localize({ key: 'miMore', comment: ['&& denotes a mnemonic'] }, "&&More..."), 'workbench.action.openRecent')); openRecentMenu.append(__separator__()); - openRecentMenu.append(new MenuItem(this.likeAction('workbench.action.clearRecentFiles', { label: this.mnemonicLabel(nls.localize({ key: 'miClearRecentOpen', comment: ['&& denotes a mnemonic'] }, "&&Clear Recently Opened")), click: () => this.historyMainService.clearRecentlyOpened() }))); + + let clearRecentFiles: MenuItem; + if (hasNoWindows) { + clearRecentFiles = new MenuItem(this.likeAction('workbench.action.clearRecentFiles', { label: this.mnemonicLabel(nls.localize({ key: 'miClearRecentOpen', comment: ['&& denotes a mnemonic'] }, "&&Clear Recently Opened")), click: () => this.historyMainService.clearRecentlyOpened() })); + } else { + clearRecentFiles = this.createMenuItem(nls.localize({ key: 'miClearRecentOpen', comment: ['&& denotes a mnemonic'] }, "&&Clear Recently Opened"), 'workbench.action.clearRecentFiles'); + } + + openRecentMenu.append(clearRecentFiles); } } -- GitLab