KR34T1V
KR34T1V

Reputation: 493

Vscode API - Custom View Container Not Showing

I am currently writing a vs-code FTP type extension, which requires me to use the "TreeView". I have found this link:

https://code.visualstudio.com/api/extension-guides/tree-view

Which guides you through adding a tree view to the sidebar. However I am having trouble getting this off the ground, Step one on the above mentioned guide already does not seem to add the icon to my vscode sidebar? Thus holding from making any progress...

Obviously I am misunderstanding something! I am rather new to TypeScript and have trouble following others code on this subject. Please could anyone just help me getting the first step working?

This is my package.json contributes:

"contributes": {
    "commands": [
        {
            "command": "extension.helloWorld",
            "title": "Hello World"
        }
    ],
    "viewsContainers": {
        "activitybar": [
            {
                "id": "live-workspace",
                "title": "Live-Workspace",
                "icon": "./src/Treeview/laptop.svg"
            }
        ]
    }
}

From what I understand this should place a "functionless" icon on the sidebar? Am I understanding this wrong? Is there more to be done to achieve this? Thanks!

Upvotes: 13

Views: 2996

Answers (1)

Gama11
Gama11

Reputation: 34158

A view container will only show up if it contains at least one view. It works for me once I also add the following to the contributes section:

"views": {
    "live-workspace": [
        {
            "id": "exampleView",
            "name": "Example View"
        }
    ]
}

Upvotes: 10

Related Questions