-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Sub menus for Editor Context Menu #9827
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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. |
@DanTup Regarding all those linked issues pointing towards more refactoring, please sync with @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 |
@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 @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 |
updates on this? I wish I could create an extension to create new file from a template like they do in PHPStorm |
This comment has been minimized.
This comment has been minimized.
AFAIK it's not yet possible for extensions to contribute submenus. See #85218 (comment) for my hope that it'll come soon. |
I'm also interested on it. |
We love to see that too. Want to use it in the standalone monaco editor. |
Another +1 from me. Grouping editor/context commands into sub menus would be amazing to have. |
@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 |
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? @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 |
just wondering, is it available now for adding submenu to context menu? Thanks |
Now available in Insiders as a proposed API, slated for finalization in in the next-but-one release. |
Thanks for your reply! @gjsjohnmurray , May I know when it will be public? |
The related issue (#100172) Is currently showing as on the September 2020 milestone, meaning it's slated to ship in Stable in early October. |
Closing this, since it's done in |
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:
I believe adding all of them to the context menu without adding them as sub menus could result in a cluttered UX.
The text was updated successfully, but these errors were encountered: