Remove/unregister entire menu items along with their corresponding submenus

Upon including the common theia packages in a project, the menu items that come up are ‘FIle’, ‘Edit’, ‘Selection’, ‘View’, ‘Go’, ‘Terminal’, ‘Help’ and they have submenus under them. For eg: New File, New Folder actions come up under the ‘File’ menu. Now, I can unregister these submenu actions using the unregisterMenuAction method, and they are removed from their corresponding menu options in the UI. But even after unregistering all submenu items under them, the menu item still comes up on the UI. For example, say I do not want the ‘Selection’ menu on the top menubar i.e. I do not want it to be displayed at all in the UI, how do I do it? Also, how do I add a new menu with a title, say ‘Options’ which would be having its own set of submenus.

[original thread by rhendricks]

registerSubmenu should allow to add new Options menu to MAIN_MENU_BAR


@anton-kosyakov I have another question. Say, I don’t want the Outline widget in the application at all. I want it removed from the right sidepanel in addition to the submenu option under View Menu. I do not want the user to enable that widget by any means. How do I do it ?


You could exclude the outline-view package from your application maybe?

At the moment it is very difficult to completely remove the outline-view since it is pulled by @theia/monaco. corresponding issue. The best approach or workaround would be to remove the menu item, and remove the outline-view from the list of default widgets (widgets that appear when first starting the application with a new workspace).

You can remove it with DI. something like:

        registerCommands: () => { },
        registerMenus: () => { },
        registerKeybindings: () => { },
        registerToolbarItems: () => { }
    } as any);


Thanks @anton-kosyakov . Works perfectly.