Skip to content

Add support for bringing references with copy/pastes #351

Open

Description

@DanTup

We'd need microsoft/vscode#30066 in order to do this; but the analysis server is getting the ability to request imports that affect a range of code. We can use this during a Copy operation to stash the list (we should also stash the text being copied, to protect against external clipboard changes between copy/paste operations in Code) and then fetch the edits required to add those imports during a paste.

Activity

  1. added
    in editor
    is enhancement
    blocked on vs code / lsp / dap
    on Jul 6, 2017
  2. added this to the Backlog milestone on Feb 21, 2018
  3. DanTup commented on Sep 24, 2022

    @DanTup
    MemberAuthor

    @badaszszsz there are notes in https://github.com/Dart-Code/Dart-Code/blob/master/CONTRIBUTING.md about how to contribute (including running the extension from source).

    Unfortunately if your plan was to work on this issue, it's currently blocked by not having the required APIs in VS Code and LSP to handle copy/pasting.

  4. DanTup commented on Sep 24, 2022

    @DanTup
    MemberAuthor

    I just saw your comment on microsoft/vscode#30066. The API in VS Code is still only "proposed" so it's not yet usable in a shipping extension (it's only for testing). However we're also using LSP here, so we'd also need to wait for it to become part of LSP, and added to the LSP client (or, if it seems unlikely to be added to LSP, we would need to add custom messages).

    In either case, there would need to be some work in the Dart analysis server (either to implement the new LSP messages, or to implement custom messages that the extension could call).

    This shouldn't deter you from contributing, but this particular issue might not be the simplest one to get started with.

  5. lukehutch commented on Dec 12, 2024

    @lukehutch

    The latest stable release of VS code added import auto-add for pasted code, for JS and TS, so it should be possible now.

  6. DanTup commented on Dec 12, 2024

    @DanTup
    MemberAuthor

    It's unfortunately not yet, TS is allowed to use proposed APIs but we cannot 🙃

    They did say that they hope to finalize it in the new year - however, we also need to get it into LSP to avoid implementing it twice - so once it's finalized in VS Code, there will be some LSP (spec/VS Code LSP client) work first, then we need an LSP version to ship, then we can implement it in the Dart server.

    If the LSP work misses the next LSP release (which it might, since I think that's on the verge of releasing), then we might want to consider custom requests in the meantime.

  7. DanTup commented on Dec 12, 2024

    @DanTup
    MemberAuthor
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

    blocked on vs code / lsp / dapin editoris enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions