How do you add a context menu? (in the explorer and/or the editor)
I tried the following which doesn't work:
{
"command": "extension.sayHello",
"title": "Say Hello",
"context": {
"where": "explorer/context",
"when": "json"
}
}
That's based on:
https://github.com/Microsoft/vscode/issues/3192
https://github.com/Microsoft/vscode/pull/7704
For those who don't know, the context menu is the little menu that opens when you click with the right button of the mouse on some empty space of the folder.
You can browse and install extensions from within VS Code. Bring up the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of VS Code or the View: Extensions command (Ctrl+Shift+X). This will show you a list of the most popular VS Code extensions on the VS Code Marketplace.
The extensionAPI documentation has a working example: https://code.visualstudio.com/docs/extensionAPI/extension-points
"contributes": {
"commands": [
{
"command": "extension.sayHello",
"title": "Say Hello"
}
],
"menus": {
"explorer/context": [{
"when": "resourceLangId == javascript",
"command": "extension.sayHello",
"group": "YourGroup@1"
}]
}
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With