-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Add Git Stage action to editor title (#187893) #190661
base: main
Are you sure you want to change the base?
Conversation
/assign @lszomoru |
Updated from main and ready for your consideration @lszomoru |
@lszomoru any thoughts yet about this PR, which I submitted last August in response to you tagging the associated issue as "help wanted"? |
I think that this requires ability to hide the actions from the More Actions menu too. Currently, hiding buttons on this toolbar puts them to the menu, that becomes an issue if custom Extension fills that menu with custom items. |
Rebased to Also fixed Command Palette |
Sorry for not getting back to you on this until now.
This is problematic from a performance perspective since you can have a large number of changed resources and we do not want push all this information from the git extension to core as a context key. We already have commands contributed by the git extension |
This PR closes #187893
For git users it adds a Stage button to the editor title of a file with unstaged changes.
To achieve this I first added to core a new context key
scmActiveResourceGroupMemberships
which is an array of string ids of the resource groups the active resource is present in. The built-in Git extension uses this to contribute its Stage command to the title of an editor with unstaged changes.I had to work around a limitation of the where-clause's
in
operator, which can only search an array-type context key for a value that matches another context key, not a constant.I also used fractionally-negative order suffixes on the added command
git.stage
and its already-existing cousingit.openChange
so they are adjacent but don't precede anyeditor/title/run
contribution (screenshot shows this coming from the vscode-mock-debug extension).If any existing users are upset by this button appearing they can easily use its context menu to demote it to the
...
menu.