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

extension-api: adds enablement in contributed commands #1703

Closed
benoitf opened this issue Mar 15, 2023 · 2 comments
Closed

extension-api: adds enablement in contributed commands #1703

benoitf opened this issue Mar 15, 2023 · 2 comments

Comments

@benoitf
Copy link
Collaborator

benoitf commented Mar 15, 2023

Is your enhancement related to a problem? Please describe

Sometimes we don't want to have a command being enabled

For example if we're not matching all required conditions, commands should not be available.

Describe the solution you'd like

Adds enablement as a command contribution

  "contributes": {
    "commands": [
      {
        "command": "my.command",
        "title": "My Command",
        "enablement": "view == myViewsExplorerID"
      },

enablement is a when-clause where we can have access to Podman Desktop current contexts objects (like the current view, etc) or some custom context

to register a custom context, extension should call something like

podmanDesktopAPI.commands.executeCommand('setContext', 'myExtension.showMyCommand', true);

enablement would be then

 "enablement": "myExtension.showMyCommand"

note: enablement on commands should also work on contributed views with a when clause

Describe alternatives you've considered

No response

Additional context

No response

Copy link
Contributor

This issue has been automatically marked as stale because it has not had activity in the last 6 months. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!

@benoitf
Copy link
Collaborator Author

benoitf commented Feb 26, 2024

implemented

@benoitf benoitf closed this as completed Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants