I am creating an extension for vscode and i am trying to change the icon displayed near the tree view.
I have seen this documentation but it is not very detailed.
I have also tried to do what is discussed in this post but it has not worked for me. There you have the code of my package.json:
"views": {
"my-sidebar": [
{
"id": "my-history-tree",
"name": "History",
"contextualTitle": "History",
"type": "tree",
"icon": "$(briefcase)"
}
]
},
I’ve also looked at some examples that vscode provides, but couldn’t find any. I only found this one that uses an SVG directly.
So how can I use vscode’s built-in icons without having to install any dependencies?
2
Answers
The vscode documentation is grossly incomplete. Apparently the "icon" configuration that is in the views of the "views" section is not to change the icon. But if you drag the view to another place (such as the activity bar) where the title cannot be displayed, then that icon is displayed. But the icon that appears next to the view, cannot be changed.
You can’t use octicons as icons for Activity Bars and/or Views. Instead, you must use image files, and SVGs are the suggested format.
If you hover the
icon
property in thepackage.json
file, you will see this hint:A similar hint is displayed when you hover the
icon
message for theactivityBar
:Hope this helps