Vscode: Add API support for submenus

Created on 15 Jun 2020  路  12Comments  路  Source: microsoft/vscode

Add support for submenus to simplify the menu structure of the Git extensions '...' menu.

api api-finalization feature-request insiders-released menus on-release-notes verification-needed verified

Most helpful comment

See #9827

I'd particularly like https://github.com/microsoft/vscode/issues/9827#issuecomment-619989638 to be catered for in the new API, so an extension can contribute a submenu whose contents are computed at display-time.

All 12 comments

See #9827

I'd particularly like https://github.com/microsoft/vscode/issues/9827#issuecomment-619989638 to be catered for in the new API, so an extension can contribute a submenu whose contents are computed at display-time.

Syntax proposal:

{
  "contributes": {
    "menus": {
      "scm/title": [
        {
          "command": "git.commit",
          "group": "navigation"
        },
        {
          "submenu": "git.stage",
          "group": "navigation"
        }
      ],
      "git.stage": [
        {
          "command": "git.stageAll",
          "group": "navigation"
        },
        {
          "command": "git.stageUntracked",
          "group": "navigation"
        }
      ]
    },
    "submenus": [
      {
        "id": "git.stage",
        "label": "Stage",
        "icon": "$(something)"
      }
    ]
  }
}

Syntax proposal:

@joaomoreno Maybe extend the syntax of submenus contribution to support submenus that call the extension at display-time to obtain their contents.

That will definitely not be in there for the first iteration. That should even be generalized for regular menus.

@jrieken Added the icon property in the submenus contribution, in order to make submenus work in toolbars. 馃憤

Re-opening for the finalisation process...

@jrieken I had this one created: https://github.com/microsoft/vscode/issues/103946

I leave it up to you to decide which one to keep. I won't be able to work in finalizing it since I'm out in August so after choosing the issue, pick one option:

  1. Keep it in August and assign someone else;
  2. Move it to September and assign myself.

I leave it up to you to decide which one to keep.

The newish flow is to have a single item that can be followed throughout the phases of idea, proposal, and finalization. September is good for me

When will submenu apis be stable?

With the next upcoming stable release: September 2020.

Verification

This new API should be usable without the proposed flag!

Is it possible to change the Submenu via Code? (= alter the Package.json?)
I need to expose some menuitems programatically..

Pinging @joaomoreno
Sorry for pinging you - do you know whether this is possible or will be available in the near future?

Was this page helpful?
0 / 5 - 0 ratings