-
Notifications
You must be signed in to change notification settings - Fork 35.7k
Closed
Labels
apiapi-finalizationapi-proposalfeature-requestRequest for new features or functionalityRequest for new features or functionalitytree-viewsExtension tree view issuesExtension tree view issuesverification-neededVerification of issue is requestedVerification of issue is requestedverifiedVerification succeededVerification succeeded
Milestone
Description
I would like to have the selected context passed to view commands so that I can act on the selected node in the tree. for example, let's say I want to have a command in the Docker explorer Navigation area (next to where it says "DOCKER" on the sash) that runs the selected image in the tree.
"view/title": [
{
"command": "vscode-docker.explorer.run",
"when": "view == dockerExplorer",
"group": "navigation"
}
],I would register my command:
vscode.commands.registerCommand('vscode-docker.explorer.run', (context?: any, selectedContext?: any[]) => dockerExplorerProvider.run(context, selectedContext));
And then in my command I can get the selected node(s) from the tree
build(context?: any): void {
if (selectedContext.length >0) {
// work on multi selected images
}
...
if (context) {
// work on selected image
} else {
// pop a quick pick to list images
}
// ...
}eamodio, d-akara, bogobogo, Gruntfuggly, alexanderGalushka and 4 more
Metadata
Metadata
Labels
apiapi-finalizationapi-proposalfeature-requestRequest for new features or functionalityRequest for new features or functionalitytree-viewsExtension tree view issuesExtension tree view issuesverification-neededVerification of issue is requestedVerification of issue is requestedverifiedVerification succeededVerification succeeded