I want to add new menu item next it “Help” Where should I look for it ?
@gauravthorath thank you for the question, you can take a look at the docs regarding contributing menu items.
The implementation for the Help
menu can be found at:
export const VIEW_EDITOR_SUBMENU_ORTHO = [...VIEW_EDITOR_SUBMENU, '2_editor_submenu_ortho'];
export const VIEW_VIEWS = [...VIEW, '2_views'];
export const VIEW_LAYOUT = [...VIEW, '3_layout'];
export const VIEW_TOGGLE = [...VIEW, '4_toggle'];
export const MANAGE_GENERAL = [...MANAGE_MENU, '1_manage_general'];
export const MANAGE_SETTINGS = [...MANAGE_MENU, '2_manage_settings'];
export const MANAGE_SETTINGS_THEMES = [...MANAGE_SETTINGS, '1_manage_settings_themes'];
// last menu item
export const HELP = [...MAIN_MENU_BAR, '9_help'];
}
export namespace CommonCommands {
export const FILE_CATEGORY = 'File';
export const VIEW_CATEGORY = 'View';
export const CREATE_CATEGORY = 'Create';
export const PREFERENCES_CATEGORY = 'Preferences';
export const MANAGE_CATEGORY = 'Manage';
this.resourceContextKey.set(resourceUri);
};
updateContextKeys();
this.selectionService.onSelectionChanged(updateContextKeys);
}
registerMenus(registry: MenuModelRegistry): void {
registry.registerSubmenu(CommonMenus.FILE, nls.localizeByDefault('File'));
registry.registerSubmenu(CommonMenus.EDIT, nls.localizeByDefault('Edit'));
registry.registerSubmenu(CommonMenus.VIEW, nls.localizeByDefault('View'));
registry.registerSubmenu(CommonMenus.HELP, nls.localizeByDefault('Help'));
// For plugins contributing create new file commands/menu-actions
registry.registerIndependentSubmenu(CommonMenus.FILE_NEW_CONTRIBUTIONS, nls.localizeByDefault('New File...'));
registry.registerMenuAction(CommonMenus.FILE_SAVE, {
commandId: CommonCommands.SAVE.id
});
registry.registerMenuAction(CommonMenus.FILE_SAVE, {
commandId: CommonCommands.SAVE_ALL.id
});
In your case you’ll want to create a new menu path from the MAIN_MENU_BAR
and add commands to that path, ex: export const CUSTOM_MAIN_MENU_ITEM = [...MAIN_MENU_BAR, '11_custom']
.