Commands can be registered via CommandContribution
, similiar menu’s are registered via MenuContribution
. Is it also possible to register Commands or Menus at a later moment, for example based on something a user did? And if so, how should that code look like? I would expect something like this:
...
{
constructor(
@inject(MenuModelRegistry) private readonly menuModelRegistry: MenuModelRegistry
) { }
registerMenu(): void {
this.menuModelRegistry.registerMenuAction(CommonMenus.EDIT_FIND, {
commandId: CommandIdd,
label: 'Custom menu entry'
});
}
Should this work? I tried it but did not see the menu item coming.
Thank you for your feedback.