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
Can we have the ability to define sub menus for editor context menus (possibly to the editor/title men too).
For instance when adding menu items for refactoring there could be plenty of refactoring items:
Extract variable
Extract method
Extract constant
Rename
Move class
Change signature... etc
I believe adding all of them to the context menu without adding them as sub menus could result in a cluttered UX.
Reacted by Alessandro Fragnani, Ramya Rao, BenjaVR, Jon Ludwig, Matthew Downey, Sebastian Zaha, Michael Bensoussan, kenijo, Eric Blade, Danny Tuppeny and 45 more
Reacted by Eric Blade, Mike Lischke, Güray Yarar, Ferry Kranenburg, Vaki, eine, Everett, Onwuka Gideon, Michael Kriese, Dennis van der Veeke and 1 more
May I asked about the current status of this FR? Given that we have this patch since more than a year, I wonder when we can actually use submenus in our extensions?
As well as being able to add items to a sub-menu, we should be able to do this dynamically (eg. with a request to a provider, not just declarative) so that we can disable/hide refactors that are not applicable to the current position/selection.
Reacted by myfairsyer, Ben Fisher, Alexander, John Wiseheart, Everett, cratexnet and Michael Kriese
Johannes Rieken (@jrieken) Yeah, I've somewhat changed my mind a little since the last comment. I thought we had a lot of refactors that are available "for the whole file" and would result in lightbulbs no matter where the cursor is; however there actually seem to be very few.
So for now, this isn't a big deal to me - however the idea of adding things like refactors/light bulbs to context menu has come up several times in discussions about visibility. I have noticed that the lightbulb sometimes doesn't seem very noticeable hovering over code (did it used to be in the gutter?).
Hmm, is this FR about a different way to add refactoring support or a general FR for submenus? I had the impression, it's the latter. I need a sub menu for various actions my extension can do for a (grammar) file, like showing some graphs, profiling details etc. This is not related to refactoring and hence cannot (and should not) be covered by the light bulb menu.
I think it was a general request for context menus; which I requested can be contributed dynamically (eg. not declarative, so we can handle a request for a context menu and choose what to put in there asynchronously), but possibly I also derailed a little about having lightbulbs shown in there too.
Yeah, this issue is about adding sub-menus but it seems that Danny Tuppeny (@DanTup) implements various refactoring commands and those we wouldn't like to see as separate commands but to integrate into the platform - it's similar to us not liking separate format or rename commands. However, for code actions (refactorings & quick fixes) it's more fuzzy and that's why we have the new API in place
Hello. Has this FR petered out somewhat? Or does this have a chance of being put in?
I just checked out a highlighting/marker extension, and figured: can't be that hard to make a context sub-menu which lets you toggle a highlight based on a list of colors already used in the file... Turns out it's not that simple after all.
So, umm, does this mean you need to pipeline all that through the Lightbulb instead?
Johannes Rieken (@jrieken) until now you have (understandably) resisted requests for extensions to be able to contribute menu items that get computed dynamically (i.e. at the point where the context menu is about to be displayed).
Would you consider permitting this for submenus, when (as many of us hope) it becomes possible for an extension to contribute submenus?
For instance, my extension might add an "Extra Stuff" submenu entry to the editor/context menu in such a way that when the context menu appears it shows Extra Stuff > and invokes an async function in my extension to return the computed contents of my submenu. A cancellation token would allow the menu handler to cancel my compute if the user dismissed the first-level menu before I had supplied the submenu contents. And if the user's interaction with the context menu requests display of the submenu before the async function has completed, maybe show a spinner in place of the > on the menu entry.
Another +1 from me too. It's been four years since this feature has been requested. Is there any hope we might be getting it soon, please? Anyone who can see that it's just impractical to expect extensions to keep adding their menu items all at the top level? John Murray (@gjsjohnmurray) I also add my voice here. I need to compute and generate my submenus dynamically so I'd expect to be able to do them using async functions just like the case with showQuickPick
Activity
ungod commentedon May 11, 2017
TheMegaMatt commentedon Aug 28, 2017
mike-lischke commentedon Dec 22, 2017
May I asked about the current status of this FR? Given that we have this patch since more than a year, I wonder when we can actually use submenus in our extensions?
DanTup commentedon Feb 12, 2018
As well as being able to add items to a sub-menu, we should be able to do this dynamically (eg. with a request to a provider, not just declarative) so that we can disable/hide refactors that are not applicable to the current position/selection.
jrieken commentedon Feb 26, 2018
Danny Tuppeny (@DanTup) Regarding all those linked issues pointing towards more refactoring, please sync with Matt Bierner (@mjbvz) and me about our new code action types. Idea is that you predefine certain code action types, e.g. this is about extracting and we then populate the light bulb and a (new) refactorings menu for you. See https://code.visualstudio.com/updates/v1_20#_codeactionprovider-improvements
DanTup commentedon Feb 26, 2018
Johannes Rieken (@jrieken) Yeah, I've somewhat changed my mind a little since the last comment. I thought we had a lot of refactors that are available "for the whole file" and would result in lightbulbs no matter where the cursor is; however there actually seem to be very few.
So for now, this isn't a big deal to me - however the idea of adding things like refactors/light bulbs to context menu has come up several times in discussions about visibility. I have noticed that the lightbulb sometimes doesn't seem very noticeable hovering over code (did it used to be in the gutter?).
mike-lischke commentedon Feb 26, 2018
Hmm, is this FR about a different way to add refactoring support or a general FR for submenus? I had the impression, it's the latter. I need a sub menu for various actions my extension can do for a (grammar) file, like showing some graphs, profiling details etc. This is not related to refactoring and hence cannot (and should not) be covered by the light bulb menu.
DanTup commentedon Feb 26, 2018
I think it was a general request for context menus; which I requested can be contributed dynamically (eg. not declarative, so we can handle a request for a context menu and choose what to put in there asynchronously), but possibly I also derailed a little about having lightbulbs shown in there too.
jrieken commentedon Feb 27, 2018
Yeah, this issue is about adding sub-menus but it seems that Danny Tuppeny (@DanTup) implements various refactoring commands and those we wouldn't like to see as separate commands but to integrate into the platform - it's similar to us not liking separate format or rename commands. However, for code actions (refactorings & quick fixes) it's more fuzzy and that's why we have the new API in place
3dots commentedon Jan 3, 2019
Hello. Has this FR petered out somewhat? Or does this have a chance of being put in?
I just checked out a highlighting/marker extension, and figured: can't be that hard to make a context sub-menu which lets you toggle a highlight based on a list of colors already used in the file... Turns out it's not that simple after all.
So, umm, does this mean you need to pipeline all that through the Lightbulb instead?
6 remaining items
gjsjohnmurray commentedon Jan 20, 2020
AFAIK it's not yet possible for extensions to contribute submenus. See #85218 (comment) for my hope that it'll come soon.
damgot commentedon Jan 31, 2020
I'm also interested on it.
I've so many command in my extension's editor context menu... I really need to be able to arrange them in sub-menus
viceice commentedon Mar 4, 2020
We love to see that too. Want to use it in the standalone monaco editor.
sentry07 commentedon Apr 24, 2020
Another +1 from me. Grouping editor/context commands into sub menus would be amazing to have.
gjsjohnmurray commentedon Apr 27, 2020
Johannes Rieken (@jrieken) until now you have (understandably) resisted requests for extensions to be able to contribute menu items that get computed dynamically (i.e. at the point where the context menu is about to be displayed).
Would you consider permitting this for submenus, when (as many of us hope) it becomes possible for an extension to contribute submenus?
For instance, my extension might add an "Extra Stuff" submenu entry to the editor/context menu in such a way that when the context menu appears it shows
Extra Stuff >and invokes an async function in my extension to return the computed contents of my submenu. A cancellation token would allow the menu handler to cancel my compute if the user dismissed the first-level menu before I had supplied the submenu contents. And if the user's interaction with the context menu requests display of the submenu before the async function has completed, maybe show a spinner in place of the>on the menu entry.Blaiski commentedon May 13, 2020
Another +1 from me too. It's been four years since this feature has been requested. Is there any hope we might be getting it soon, please? Anyone who can see that it's just impractical to expect extensions to keep adding their menu items all at the top level? John Murray (@gjsjohnmurray) I also add my voice here. I need to compute and generate my submenus dynamically so I'd expect to be able to do them using async functions just like the case with showQuickPick
Thank you
zesluo commentedon Aug 18, 2020
just wondering, is it available now for adding submenu to context menu? Thanks
gjsjohnmurray commentedon Aug 19, 2020
Now available in Insiders as a proposed API, slated for finalization in in the next-but-one release.
zesluo commentedon Aug 19, 2020
Thanks for your reply! John Murray (@gjsjohnmurray) , May I know when it will be public?
gjsjohnmurray commentedon Aug 19, 2020
The related issue (#100172) Is currently showing as on the September 2020 milestone, meaning it's slated to ship in Stable in early October.
joaomoreno commentedon Sep 1, 2020
Closing this, since it's done in
master.