rust-lang / rust-lang/rust-analyzer
VSCode indents method call chains incorrectly
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
When typing in this block of code,
pub fn run() {
// ...
loop {
list.items
.iter()
.enumerate()
.for_each(/* ... */);
println!(/* ... */);
}
}
I observer the following behaviour:
If I hit enter after list.items, it does not add an extra indent.
If I hit enter after the for_each, it does not remove the extra indent, so I have to press backspace
Note that I use vim mode, but using VSCode's indent lines feature will cause a similar problem as well, so I don't think it has anything to do with vim.
rust-analyzer version: (eg. output of "Rust Analyzer: Show RA Version" command)
0f8c96c92 2022-01-10 stable
rustc version: (eg. output of rustc -V)
1.57.0 (f1edd0429 2021-11-29)
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 behavior in VSCode using the Rust snippet, comparing Enter after list.items with Enter after for_each. Trace rust-analyzer's indentation behavior; done when chained calls gain and remove the expected indentation without requiring manual backspace.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, vscode
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100