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
Support scmResourceState
in when
clauses
#90952
Conversation
fixes microsoft#86180 * Adds `contextValue?: string` to the SourceControlResourceState * Allows when clause in scm/resourceState/context menus to use scmResourceState
f060616
to
11f523c
Compare
It's actually a perf issue if we create menus for each element. So... could we share them between elements if they have the same context key? |
I'll have a look at that - my initial implementation was caching the resource menu by resource using a map in I could make that a map based on |
@joaomoreno - updated with one menu per context |
@joaomoreno now the endgame is done, could we look at merging this if the approach is ok? (I wasn't 100% sure if the the proposed API was the right place for this) |
@joaomoreno any chance of getting this moved on please? |
Is there anything blocking this? is it because I didn't write to santa claus this year? I knew I should have put this on my wishlist |
@joaomoreno I'd like to add my voice to the request to get this merged. Or is there a reason it can't go in? |
@mjcrouch I haven't looked at this too deeply (so take this with a grain of salt) -- but is there a need for the Is that not the case? |
@eamodio thanks for reviewing - it's been quite a while since I wrote the code so I'm stretching my memory, but iirc there is currently just one menu instance for each group, and So in order to render different context items for different resource objects, we need to create a menu per |
@mjcrouch You might be right, but I would recommend giving it a shot to see if it works properly without it. |
@eamodio I gave it a try (I think this may have been what I tried originally) - it does seem to work for the right click context menu, but does not work for the inline icons; they all end up with the same set of icons even if they have different contextValues. At a total guess I wonder if there is some work done to update the items on right click that maybe is not done on hover for performance reasons |
Hrm, I think it has to do with the |
Assigning for August so I get a good look at this next week. 👍 |
just happened to notice #104089 - |
Yeah, for sure. No worries, I'll handle the conflicts. 👍 |
Thanks for the PR, @mjcrouch, it was really polished!👏 I merged it into the latest |
thank you - this will really help to make my menus more usable :) |
contextValue?: string
to the SourceControlResourceStateExample - I have hidden the "revert" item from the inline and context menu using a context clause like
scmResourceState == opened
This PR fixes #86180