rust-lang / rust-lang/rust-analyzer
Extend selection behaves differently between single- and multi-line statements
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Say I have code like this:
mod gl {}
fn main() {
let gl = ();
gl.GetIntegerv(gl::DRAW_FRAMEBUFFER_BINDING, &mut previous_framebuffer);
gl.BindFramebuffer(gl::DRAW_FRAMEBUFFER, self.framebuffer);
gl.FramebufferTexture2D(
gl::DRAW_FRAMEBUFFER,
gl::COLOR_ATTACHMENT0,
gl::TEXTURE_2D,
self.texture,
0,
);
}
I'd like to wrap all calls in some other call. I set up multiple cursors like so:

Then I hit extend selection:

Note how single-line statements got fully selected up to ;, but the multi-line one didn't. In fact, it requires one more extend selection:

But now the single-line statements have ; selected, too. All this means I have to first deal with single-line statements, and then, separately, with multi-line statements. It would be nice if the behavior was unified.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Rust example using multiple cursors and Extend Selection, then trace the editor action that computes successive selections. The issue names no source file or test; done means single-line and multi-line statements expand to consistent boundaries without requiring separate handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100