Skip to content

Show Refactors in the context menu #531

Closed

Description

@DanTup
No description provided.

Activity

  1. added
    is enhancement
    in editor
    on Feb 6, 2018
  2. added this to the v3.0.0 milestone on Feb 6, 2018
  3. DanTup commented on Feb 12, 2018

    @DanTup
    MemberAuthor

    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:

    Bulb

    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).

  4. mit-mit commented on Feb 12, 2018

    @mit-mit
    Contributor

    If declared up front, can't they be enabled/disabled dynamically based on the context?

  5. DanTup commented on Feb 12, 2018

    @DanTup
    MemberAuthor

    Kinda, but I think there are two issues:

    1. 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)
    2. 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?

  6. mit-mit commented on Feb 12, 2018

    @mit-mit
    Contributor

    Yes, I think it's worthwhile to explore this a bit more!

  7. DanTup commented on Feb 12, 2018

    @DanTup
    MemberAuthor

    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!

  8. added
    blocked on vs code / lsp / dap
    on Feb 12, 2018
  9. modified the milestones: v3.0.0, On Deck, Backlog on Feb 21, 2018
  10. added
    upstream in vs code / lsp / dap
    and removed
    blocked on vs code / lsp / dap
    on Mar 4, 2018
  11. modified the milestones: Backlog, v2.13.0 on Apr 24, 2018
  12. added 9 commits that reference this issue on Apr 24, 2018
    d9e3682
    e9a86bb
    eaec01e
    32f8a85
    e3fe23d
    2040b02
    f42160e
    a473667
    583c343
  13. DanTup commented on May 3, 2018

    @DanTup
    MemberAuthor

    For v2.13 refactors and "source actions" (currently just "organize imports") now have an entry on the context menu:

    screen shot 2018-05-03 at 2 50 29 pm

    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.

  14. removed
    upstream in vs code / lsp / dap
    on May 3, 2018
  15. changed the title [-]Can lightbulbs actions be shown in context menu?[/-] [+]Show Refactors in the context menu[/+] on May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editoris enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions