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

Open
DonJayamanne opened this Issue Jul 27, 2016 · 9 comments

Comments

Projects
None yet
6 participants
@DonJayamanne
Contributor

DonJayamanne commented Jul 27, 2016

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.

sample

sample2

@ungod

This comment has been minimized.

ungod commented May 11, 2017

+1

@TheMegaMatt

This comment has been minimized.

TheMegaMatt commented Aug 28, 2017

+1

@mike-lischke

This comment has been minimized.

mike-lischke commented 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?

@jrieken jrieken added the menus label Jan 5, 2018

@DanTup

This comment has been minimized.

DanTup commented 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

This comment has been minimized.

Member

jrieken commented Feb 26, 2018

@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

@DanTup

This comment has been minimized.

DanTup commented Feb 26, 2018

@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

This comment has been minimized.

mike-lischke commented 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

This comment has been minimized.

DanTup commented 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

This comment has been minimized.

Member

jrieken commented Feb 27, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment