Home > Back-end >  How to sort context menu elements in a TreeView in a VS Code extension?
How to sort context menu elements in a TreeView in a VS Code extension?

Time:01-31

I build a enter image description here

I want them to be sorted as in the order I entered commands in configuration. How can I control order? I can see that the same action menu of git is well organized yet has separators.

CodePudding user response:

Then you have to add them to a group and number the entries

  "menus": {
    "view/title": [
      {
        "command": "myExt.cmd1",
        "when": "view == myView",
        "group": "mygr@1"
      },
      {
        "command": "myExt.cmd2",
        "when": "view == myView",
        "group": "mygr@2"
      },
    ]
  }
  •  Tags:  
  • Related