Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[views] pass the selected tree item to a command's argument #3882

Closed
azatsarynnyy opened this issue Dec 21, 2018 · 9 comments
Closed

[views] pass the selected tree item to a command's argument #3882

azatsarynnyy opened this issue Dec 21, 2018 · 9 comments
Assignees
Labels
plug-in system issues related to the plug-in system

Comments

@azatsarynnyy
Copy link
Member

Theia should pass the selected tree item as an argument to the command executed from the context menu. See the attachments for details.
It's related only to the views contributed by the plugins.

Examples

VSCode
The selected tree item is passed to the executed command's argument and the plugin just calls the command.

vscode

Theia
The selected tree item isn't provided to the executed command and the plugin asks user to specify it manually.

theia

@azatsarynnyy azatsarynnyy added the plug-in system issues related to the plug-in system label Dec 21, 2018
@akosyakov
Copy link
Member

fyi: you should be able to retrieve the currently selected item from the global selection service

@tsmaeder
Copy link
Contributor

tsmaeder commented Feb 6, 2019

Ok this is about the contribution point https://code.visualstudio.com/api/references/contribution-points#contributes.menus
There is a "note" section saying that the uri of the "current" resource should be passed to the command.

@akosyakov
Copy link
Member

@tsmaeder it was implemented in e5c8ff9

@azatsarynnyy Could you verify?

@azatsarynnyy
Copy link
Member Author

@akosyakov I've just checked it vscode k8s extension and it works the same way as it's described in the issue. So nothing is changed in the behavior.
There's the error in the console:

root ERROR [hosted-plugin: 24614] (node:24614) UnhandledPromiseRejectionWarning: Error: The command 'null' cannot be executed. There are no active handlers available for the command. (args: [{"kind":{"displayName":"Namespace","pluralDisplayName":"Namespaces","manifestKind":"Namespace","abbreviation":"namespace"},"id":"default","metadata":{"name":"default","active":false},"resourceId":"namespace/default"}])
    at CommandRegistry.<anonymous> (http://localhost:3000/bundle.js:96000:31)
    at step (http://localhost:3000/bundle.js:95807:23)
    at Object.next (http://localhost:3000/bundle.js:95788:53)
    at http://localhost:3000/bundle.js:95782:71
    at new Promise (<anonymous>)
    at ../../packages/core/lib/common/command.js.__awaiter (http://localhost:3000/bundle.js:95778:12)
    at CommandRegistry.../../packages/core/lib/common/command.js.CommandRegistry.executeCommand (http://localhost:3000/bundle.js:95987:16)
    at CommandRegistryMainImpl.push.../../packages/plugin-ext/lib/main/browser/command-registry-main.js.CommandRegistryMainImpl.$executeCommand (http://localhost:3000/79.bundle.js:4626:72)
    at RPCProtocolImpl.push.../../packages/plugin-ext/lib/api/rpc-protocol.js.RPCProtocolImpl.doInvokeHandler (http://localhost:3000/79.bundle.js:827:23)
    at RPCProtocolImpl.push.../../packages/plugin-ext/lib/api/rpc-protocol.js.RPCProtocolImpl.invokeHandler (http://localhost:3000/79.bundle.js:812:41)

root ERROR [hosted-plugin: 24614] (node:24614) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 23)

@akosyakov
Copy link
Member

akosyakov commented Feb 7, 2019

ok, so it is unrelated to https://code.visualstudio.com/api/references/contribution-points#contributes.menus

It's related only to the views contributed by the plugins.

only to it 👍 , i updated the desc

@akosyakov akosyakov changed the title Pass the selected tree item to a command's argument [views] pass the selected tree item to a command's argument Feb 7, 2019
@tsmaeder
Copy link
Contributor

tsmaeder commented Feb 8, 2019

@akosyakov sorry, but shouldn't that be "Pass the selected tree item as an argument to a command"? At least that was the impression I got after speaking to Artem yesterday. Anyway...from the description now, I don't understand what the problem should be.

@akosyakov
Copy link
Member

akosyakov commented Feb 8, 2019

The note says only about currently selected resource (URI), which already the case.

In the case with View widget, no an URI, but a view tree item should be passed. It would require special handling.

@tsmaeder
Copy link
Contributor

tsmaeder commented Feb 8, 2019

Ok, but I don't see that in the VS Code documentation.

@vzhukovs
Copy link
Contributor

vzhukovs commented Mar 28, 2019

For this moment in progress implementing two actions:

  • Kubernetes: Add File
  • Kubernetes: Delete File

Found dependent issue, which temporary blocks the development:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plug-in system issues related to the plug-in system
Projects
None yet
Development

No branches or pull requests

4 participants