Skip to content

Refactor does not appear on editor context menu when using LSP #2885

Closed

Description

@bsutton

A few weeks ago my refactor menu stopped showing up.

I'm not certain exactly when but it's been a few weeks now (and I generally keep to the latest version of dart-code).

I can still do actions like renaming a file (I assume this built into vscode) but the refactoring of import names does not occur.

When opening the context menu from a widget none of the standard options (e.g. swap with parent) appear. image attached.

I've just tried recreating the workspace by removing the .settings, workspace file, ~/.vscode (and then reinstalled dartcode).

All with no affect.

context menu

Dart-code: v3.15.1
Vs-code: v.50.1

Activity

  1. DanTup commented on Oct 19, 2020

    @DanTup
    Member

    @bsutton is it just the Refactor entry from this menu that's missing, or do they also not show up in the lightbulb?

    I can repro them showing up in lightbulb, but no refactor menu here. If you're not seeing them in the lightbulb either, that's likely a different issue.

    I'll see if I can figure out what triggers the Refactor menu to appear (and whether it's changed in VS Code recently, which might explain it disappearing).

  2. added this to the v3.16.0 milestone on Oct 19, 2020
  3. bsutton commented on Oct 19, 2020

    @bsutton
    Author
  4. DanTup commented on Oct 26, 2020

    @DanTup
    Member

    This seems to be LSP-related. For non-LSP, our refactor provider provides metadata to VS Code to tell it we have refactors:

    https://github.com/Dart-Code/Dart-Code/blob/master/src/extension/providers/refactor_code_action_provider.ts#L21-L23

    However in LSP we don't have this - seems like we need to provide them in the ServerCapabilities.

  5. changed the title [-]refactor menu gone.[/-] [+]Refactor does not appear on editor context menu when using LSP[/+] on Oct 26, 2020
  6. DanTup commented on Oct 26, 2020

    @DanTup
    Member

    Fixed by https://dart-review.googlesource.com/c/sdk/+/169102, though it may take time to show up as it's in the SDK and will need to roll into Flutter etc.

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 editorRelates to code editing or language featuresin lsp/analysis serverSomething to be fixed in the Dart analysis serveris bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions