Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 428
KR34T1V Avatar asked Apr 05 '19 11:04

KR34T1V


1 Answers

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"
        }
    ]
}
like image 142
Gama11 Avatar answered Oct 14 '22 18:10

Gama11