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

API: Menu item enablement #21131

Closed
bpasero opened this issue Feb 22, 2017 · 9 comments
Closed

API: Menu item enablement #21131

bpasero opened this issue Feb 22, 2017 · 9 comments
Assignees
Labels
api api-finalization feature-request Request for new features or functionality menus Menu items and widget issues verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Feb 22, 2017

This used to be like that in the old world I think.

@bpasero bpasero added the scm General SCM compound issues label Feb 22, 2017
@joaomoreno joaomoreno added this to the Backlog milestone Feb 22, 2017
@joaomoreno joaomoreno added bug Issue identified by VS Code Team member as probable bug git GIT issues and removed scm General SCM compound issues labels Feb 22, 2017
@joaomoreno
Copy link
Member

@jrieken Any thoughts on contributed menu items enablement?

@jrieken
Copy link
Member

jrieken commented Feb 22, 2017

Yeah, there is no story for enablement yet. For now you make the when-clause more specific such that the menu item doesn't show. One idea could be to add an enablement-clause when defining a command. It could use the when-syntax but define enablement of a command.

@joaomoreno joaomoreno changed the title Git: action to toggle between file and changes should only be enabled if there are changes API: Menu item enablement Apr 6, 2017
@joaomoreno joaomoreno added api feature-request Request for new features or functionality and removed bug Issue identified by VS Code Team member as probable bug git GIT issues labels Apr 6, 2017
@joaomoreno
Copy link
Member

Renamed for clarity.

@garyking
Copy link

It would be great to have this, so that the Open Changes button can be greyed out when there are no changes for the current file.

@jrieken jrieken added the menus Menu items and widget issues label May 16, 2019
@jrieken jrieken self-assigned this May 16, 2019
@jrieken jrieken added this to the May 2019 milestone May 16, 2019
@jrieken
Copy link
Member

jrieken commented May 16, 2019

cc @rebornix

@jrieken
Copy link
Member

jrieken commented May 16, 2019

most work actually already happened via #41103, exposing this to extensions is the missing piece

@jrieken
Copy link
Member

jrieken commented May 16, 2019

Idea would be to allow for a precondition with the command definition. That would allow to define the condition that must be fulfilled so that this command can be run, the UX is enablement/disablement.

"contributes": {
    "commands": [
      {
        "command": "someCommand",
        "title": "My Some Command",
        "precondition": "myContext == 42",
        "category": "Something"
      },

@jrieken
Copy link
Member

jrieken commented May 21, 2019

This happened via: #74017

@jrieken
Copy link
Member

jrieken commented May 24, 2019

@rebornix While revising #74017 I missed that enablement isn't a menu property but a command property. Commands should be enable/disabled independent of their UX location. I have pushed a change for this. After discussing we have also concluded that enablement is the better name for this. Sample a command that is only enabled when having a selection in the editor

{
  "command": "extension.sayHello1",
  "title": "Hello Enablement",
  "enablement": "editorHasSelection"
}

@jrieken jrieken closed this as completed May 24, 2019
@jrieken jrieken added the verification-needed Verification of issue is requested label May 28, 2019
@rebornix rebornix added the verified Verification succeeded label May 30, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api api-finalization feature-request Request for new features or functionality menus Menu items and widget issues verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants