diff --git a/src/vs/code/electron-main/menus.ts b/src/vs/code/electron-main/menus.ts index 02de9e4df09459b4b0ed0adcfc14acd186625bf1..b86cfe2423d73cf4324a077f73451b2ae1b6c697 100644 --- a/src/vs/code/electron-main/menus.ts +++ b/src/vs/code/electron-main/menus.ts @@ -325,7 +325,13 @@ export class CodeMenu { const hide = new MenuItem({ label: nls.localize('mHide', "Hide {0}", product.nameLong), role: 'hide', accelerator: 'Command+H' }); const hideOthers = new MenuItem({ label: nls.localize('mHideOthers', "Hide Others"), role: 'hideothers', accelerator: 'Command+Alt+H' }); const showAll = new MenuItem({ label: nls.localize('mShowAll', "Show All"), role: 'unhide' }); - const quit = new MenuItem(this.likeAction('workbench.action.quit', { label: nls.localize('miQuit', "Quit {0}", product.nameLong), click: () => this.windowsMainService.quit() })); + const quit = new MenuItem(this.likeAction('workbench.action.quit', { + label: nls.localize('miQuit', "Quit {0}", product.nameLong), click: () => { + if (this.windowsMainService.getWindowCount() === 0 || !!this.windowsMainService.getFocusedWindow()) { + this.windowsMainService.quit(); // fix for https://github.com/Microsoft/vscode/issues/39191 + } + } + })); const actions = [about]; actions.push(...checkForUpdates);