You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in editorRelates to code editing or language featuresis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
We can contribute commands to the editor context menu however it seems like they have to be declared up-front (not dynamically), which means we couldn't just conditionally show the assists/fixes for the current cursor position/line.
That said, the lightbulb does appear floating based on cursor position (though I don't think it's as obvious as it could be) - I'm sure it used to be in the gutter, not sure why it was moved:
So, I think the answer to the title is "No", but I don't know if we feel we need to do anything further here (cc @mit-mit@devoncarew)? I think this discussion may have originally spawned from something @timsneath hit with refactors/fixes not appearing - but I think this may have been a bug as he subsequently has seen them in the same location (I'd advised to turn on logging and if he sees it again we can debug).
So, if there is anything we can/want to do as part of this case (I guess the real requirement was increasing visibility of refactors/etc., but I don't know if we can do that or if it's necessary if the lightbulbs are appearing correctly).
We'd need to hard-code a full list of them (currently they're a dynamic list from the server, so we don't need to do anything when new ones are added)
I don't believe we could update the contexts early enough - we need to hit the server to find out which code actions are valid whereas Code immediately renders to context menu when you right click so we'd likely end up showing the options for the previous cursor position if you right-clicked somewhere else
I think to support this nicely, it really needs proper support from code (a provider that gets called and asked for context menu items), though I don't know if they'd want to do this since it means introducing latency in showing the context menu (a slow context menu because of request/responses would probably suck). Possibly they could have a sub-menu for code actions/refactors (which would give the extensions time to get their results together before the user expands that sub-menu).
If you think it's worthwhile, I can raise an issue with Code with some notes and see what they think?
Looks like there's already a request. I've added a note about making them "dynamic" (since it woul dbe possible to support sub-menus but requiring them all to be declared/fixed up-front):
For v2.13 refactors and "source actions" (currently just "organize imports") now have an entry on the context menu:
All it does is open the lightbulb menu filtered to refactors (or in the case of source actions, shows that list, which are normally hidden from the lightbulb menu).
I don't think we're going to get any better than this, but all of our Flutter refactors are included in the "refactor" list so I think the original issue (which is people right-clicking and looking for refactors) is resolved.
in editorRelates to code editing or language featuresis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
Activity
DanTup commentedon Feb 12, 2018
We can contribute commands to the editor context menu however it seems like they have to be declared up-front (not dynamically), which means we couldn't just conditionally show the assists/fixes for the current cursor position/line.
That said, the lightbulb does appear floating based on cursor position (though I don't think it's as obvious as it could be) - I'm sure it used to be in the gutter, not sure why it was moved:
So, I think the answer to the title is "No", but I don't know if we feel we need to do anything further here (cc @mit-mit @devoncarew)? I think this discussion may have originally spawned from something @timsneath hit with refactors/fixes not appearing - but I think this may have been a bug as he subsequently has seen them in the same location (I'd advised to turn on logging and if he sees it again we can debug).
So, if there is anything we can/want to do as part of this case (I guess the real requirement was increasing visibility of refactors/etc., but I don't know if we can do that or if it's necessary if the lightbulbs are appearing correctly).
mit-mit commentedon Feb 12, 2018
If declared up front, can't they be enabled/disabled dynamically based on the context?
DanTup commentedon Feb 12, 2018
Kinda, but I think there are two issues:
I think to support this nicely, it really needs proper support from code (a provider that gets called and asked for context menu items), though I don't know if they'd want to do this since it means introducing latency in showing the context menu (a slow context menu because of request/responses would probably suck). Possibly they could have a sub-menu for code actions/refactors (which would give the extensions time to get their results together before the user expands that sub-menu).
If you think it's worthwhile, I can raise an issue with Code with some notes and see what they think?
mit-mit commentedon Feb 12, 2018
Yes, I think it's worthwhile to explore this a bit more!
DanTup commentedon Feb 12, 2018
Looks like there's already a request. I've added a note about making them "dynamic" (since it woul dbe possible to support sub-menus but requiring them all to be declared/fixed up-front):
microsoft/vscode#9827
It's worth clicking the 👍 on the top comment of that case since MS tend to work through issues sorted by the 👍's on them!
Advertise refactors/fixes to Code
Advertise refactors/fixes to Code
Advertise refactors/fixes to Code
Advertise refactors/fixes to Code
Advertise refactors/fixes to Code
Advertise refactors/fixes to Code
Advertise refactors/fixes to Code
Advertise refactors/fixes to Code
Advertise refactors/fixes to Code
DanTup commentedon May 3, 2018
For v2.13 refactors and "source actions" (currently just "organize imports") now have an entry on the context menu:
All it does is open the lightbulb menu filtered to refactors (or in the case of source actions, shows that list, which are normally hidden from the lightbulb menu).
I don't think we're going to get any better than this, but all of our Flutter refactors are included in the "refactor" list so I think the original issue (which is people right-clicking and looking for refactors) is resolved.
[-]Can lightbulbs actions be shown in context menu?[/-][+]Show Refactors in the context menu[/+]