Search code examples
vscode-extensionsvscode-api

VSCode Extension - API


I am trying to include similar icons with buttons like next to Open Editor on my vscode extension (1st image). Not sure where to add them.

enter image description here

I have worked this far:

enter image description here

Can someone tell which API to deploy next?


Solution

  • it's in your package.json -> contributes, checkout this doc, and this example

    package.json, line#149-160

        "menus": {
            "commandPalette": [
                {
                    "command": "ftpExplorer.revealResource"
                }
            ],
            "view/title": [
                {
                    "command": "nodeDependencies.refreshEntry",
                    "when": "view == nodeDependencies",
                    "group": "navigation"
                },
    

    package.json, line#67-74

        "commands": [
            {
                "command": "nodeDependencies.refreshEntry",
                "title": "Refresh",
                "icon": {
                    "light": "resources/light/refresh.svg",
                    "dark": "resources/dark/refresh.svg"
                }
    

    you need a view/title entry which points to a command entry, the icon is in the command, it can be custom image or vscode's codicon, you might want to read this doc