Search code examples
typescriptvisual-studio-codevscode-extensions

vscode extention development, panel menu?


I can't seem to find anything in 'index.d.ts' about adding menus to the panel. I'm not sure if that's what it's called. See the image below for an example. Any help on finding the references in the docs or how to add menus would be great.

Highlighted area of vscode

I looked through the API, but the only issue is I don't know what I'm looking for. Some things I looked at, but it doesn't look like it has it, were 'WebviewViewProvider' and 'WebviewView'. The only thing I thought it may be was the badges in 'WebviewView'.


Solution

  • Its called a menu, to create it you first need to register a command then in "package.json" register the command under "contributes.commands"

    {
        "command": "vsc-chat.logout",
        "title": "Logout",
        "category": "VSC Chat",
        "icon":  "media/log-out.svg"
    }
    

    Then to add the command to the panel add the following to "contributes.menus"

    "view/title": [
        {
          "command": "vsc-chat.logout",
          "group": "navigation"
        }
      ]
    

    to specify what view to add it to add the following

    "when": "view == {{viewID}}",