Skip to content
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

Port item up down movers from IntelliJ #6823

Closed
matklad opened this issue Dec 11, 2020 · 5 comments · Fixed by #8054
Closed

Port item up down movers from IntelliJ #6823

matklad opened this issue Dec 11, 2020 · 5 comments · Fixed by #8054
Labels
E-hard S-actionable Someone could pick this issue up and work on it right now

Comments

@matklad
Copy link
Member

matklad commented Dec 11, 2020

Intellij Rust has this bunch of code:

https://github.com/intellij-rust/intellij-rust/tree/25f37175094192ba88f345f03b2a4b5b941dd395/src/main/kotlin/org/rust/ide/actions/mover

this is for moving items, statements and mactch arms up and down. rust-analyzer should have this as well, although I don't think that this is exposed in the procol. Rough steps:

  • design appropriate LSP protocl extensions (see lsp-extensions.md)
  • implement in the ide crate. This only needs access to syntax, so should be rather trivial.
  • add a bunch of tests
@matklad matklad added E-hard S-actionable Someone could pick this issue up and work on it right now labels Dec 11, 2020
@kjeremy
Copy link
Contributor

kjeremy commented Dec 11, 2020

Alternatively could we do this with a command?

@matklad
Copy link
Member Author

matklad commented Dec 11, 2020

Yeah, that would need to be a command in VS Code, and a request-response in LSP. The user can then bind the command to ctrl+shift+up/down or whatever

@kjeremy
Copy link
Contributor

kjeremy commented Dec 11, 2020

I think the LSP side could be a command as well to avoid another custom request/response.

@matklad
Copy link
Member Author

matklad commented Dec 11, 2020

Ah, sorry, I've misunderstood. Your idea is that the client will send workspace/executeCommand, and the server would use workspace/applyEdit?

If that's right, I'd rather do a custom extension still, for two reasons:

  • I am not a fan of server-side initiated applyEdit, as that loses causality
  • THis will still require custom per editor code to surface the command in the UI.

@kjeremy
Copy link
Contributor

kjeremy commented Dec 11, 2020

Yes that was the idea. You would still need custom code to surface the command of course but the benefit to other clients is that they wouldn't have to write as much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-hard S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants