SubMenus

Contribute submenu items via sumiContributes

When you need to register a secondary menu, you can register your menubar item through the sumiContributes field in package.json, where the data structure is as follows:

interface IContributedSubmenuItem {
  id: string; // As the menu-id of submenu-id, you can contribute menu items here through menus
  title: string; // display text
  group?: string;
  icon: {
    light: string;
    dark: string;
  };
}

Among them, id, title and icon are required items, and group is an optional item, which is used to define the grouping of the menu.

Example

Use the below contributes:

{
  "sumiContributes": {
    "submenus": {
      "git_clone_menubar": [
        {
          "id": "my_submenu_1",
          "title": "%command.init%"
        }
      ],
      "tabbar/bottom/common": [
        {
          "id": "my_submenu_2",
          "title": "%command.openRepository%",
          "group": "navigation",
          "icon": {
            "light": "resources/icons/light/git.svg",
            "dark": "resources/icons/dark/git.svg"
          }
        }
      ],
      "settings/icon/menu": [
        {
          "id": "my_submenu_3",
          "title": "%command.openRepository%",
          "group": "navigation"
        }
      ]
    },
    "menubars": [
      {
        "id": "git_clone_menubar",
        "title": "%command.clone%",
        "order": 10
      }
    ],
    "menus": {
      "git_clone_menubar": [
        {
          "command": "git.init",
          "group": "navigation",
          "when": "config.git.enabled && !scmProvider && gitOpenRepositoryCount == 0 && workspaceFolderCount != 0"
        }
      ],
      "my_submenu_1": [
        {
          "command": "git.close",
          "group": "navigation"
        }
      ],
      "my_submenu_2": [
        {
          "command": "git.commit",
          "group": "navigation",
          "when": "scmProvider == git"
        }
      ],
      "my_submenu_3": [
        {
          "command": "git.stageAll",
          "group": "1_modification"
        }
      ]
    }
  }
}

The registration effect under tabbar/common/bottom position in the bottom panel:

Bottom

Set the registration effect under the position of the button settings/icon/menu:

Settings

Registration effect under tabbar/bottom/common position in the top TabBar area:

TabBar

Actual business application effect (custom registration point):

Custom

General menu registration, see: Menus Contribution Points