microsoft / vscode-docs

Public documentation for Visual Studio Code
http://code.visualstudio.com/docs
Other
5.65k stars 4.58k forks source link

Document that you can contribute to the terminal view via view.title #6581

Open Tyriar opened 1 year ago

Tyriar commented 1 year ago

https://code.visualstudio.com/api/references/contribution-points#contributes.views

Part of https://github.com/microsoft/vscode/issues/79034, I just realized we've supported this for a long time via view.title:

"view/title": [
    {
    "command": "terminalTest.createTerminal",
    "when": "view == terminal",
    "group": "navigation"
    }
],

Image

Tyriar commented 1 year ago

@sbatten @gregvanl I see contributes.menus points at contributes.views but doesn't give an example of "when": "view == someId", was this intentional or are we just missing this? Ideally we'd have a list of all the views in the docs so it's obvious what you can contribute to.

sbatten commented 1 year ago

@sandy081 originally did this I believe, but I don't think there is a list since this works for any view id.

sandy081 commented 1 year ago

This seems to be mentioned in the tree view API doc here - https://code.visualstudio.com/api/extension-guides/tree-view - But it does not seems to explicit that one can contribute commands to any view. Probably this should be mentioned in menu contributions documentation?

Tyriar commented 1 year ago

@sandy081 thanks for the info! I'll mention it somewhere around menu contributions as I know users have wanted to add actions to the terminal for a while and I only discovered you could do so when adding other terminal menu contributions and realizing it didn't need one.