Skip to content
Discussion options

You must be logged in to vote

Hi, I don't know if it's the best solution, but in my case I changed the getMenuItems from MenuRegistry, something like this:

    MenuRegistry.getMenuItems = function (this, id) {
      const result = menuItems.call(this, id);
      return result.filter((menuItem: IMenuItem | ISubmenuItem) => {
        const commandOrSubmenu = 'command' in menuItem ? menuItem.command : menuItem.submenu;
        return !commandOrSubmenu || stringFilter.matches(commandOrSubmenu.id);
      });
    };

This way, I maintain a list of "forbidden" menu items that I don't want to be shown, execute the original command with menuItems..call(...) and then filter the result.

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
1 reply
@wfortin
Comment options

Answer selected by wfortin
Comment options

You must be logged in to vote
5 replies
@wfortin
Comment options

@CGNonofr
Comment options

@wfortin
Comment options

@CGNonofr
Comment options

@wfortin
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants