"contributes": {
"commands": [
{
"command": "command.id",
"title": "My View Action",
"icon": {
"light": "resources/light/refresh.svg",
"dark": "resources/dark/refresh.svg"
}
}
],
"menus": {
"view/title": [
{
"command": "command.id",
"when": "view == your.view.id",
"group": "navigation"
}
]
}
}
You can refer to https://code.visualstudio.com/api/extension-guides/tree-view#view-actions