Skip to content

Commit

Permalink
don't ask to install an incomplete menu
Browse files Browse the repository at this point in the history
  • Loading branch information
sbatten committed Aug 3, 2018
1 parent dbd9ef1 commit e30a864
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/vs/workbench/browser/parts/menubar/menubarPart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,10 @@ export class MenubarPart extends Part {
this.setupCustomMenubar();
} else {
// Send menus to main process to be rendered by Electron
this.menubarService.updateMenubar(this.windowService.getCurrentWindowId(), this.getMenubarMenus(), this.getAdditionalKeybindings());
const menubarData = {};
if (this.getMenubarMenus(menubarData)) {
this.menubarService.updateMenubar(this.windowService.getCurrentWindowId(), menubarData, this.getAdditionalKeybindings());
}
}
}

Expand Down Expand Up @@ -901,17 +904,23 @@ export class MenubarPart extends Part {
return keybindings;
}

private getMenubarMenus(): IMenubarData {
let ret: IMenubarData = {};
private getMenubarMenus(menubarData: IMenubarData): boolean {
if (!menubarData) {
return false;
}

for (let topLevelMenuName of Object.keys(this.topLevelMenus)) {
const menu = this.topLevelMenus[topLevelMenuName];
let menubarMenu: IMenubarMenu = { items: [] };
this.populateMenuItems(menu, menubarMenu);
ret[topLevelMenuName] = menubarMenu;
if (menubarMenu.items.length === 0) {
// Menus are incomplete
return false;
}
menubarData[topLevelMenuName] = menubarMenu;
}

return ret;
return true;
}

private isCurrentMenu(menuIndex: number): boolean {
Expand Down

0 comments on commit e30a864

Please sign in to comment.