rust-lang / rust-lang/rustfmt

Add separate "continuation indent space" setting

Open
#3,642 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature-request P-low
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

"tab_space = 2" will set my block indent to 2, but it also sets the indentation for continued lines (function params, long lines, etc) to 2 as well. It would be great to have a separate option for continued lines.

For example, the Google Style guide uses and indent=2 and continued_indent=4, which for me is more readable as I can easily see which indentations are blocks and which are continued lines just by scanning left alignment.

Perhaps we can add a 'continued_tab_space' option? To avoid changing behavior for just setting "tab_space = 2", perhaps we can default continued_tab_space to be unset, and when it is unset defer to tab_space for both?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating how the tab_space setting controls block and continued-line indentation in rustfmt. Add a separate continued_tab_space setting with the requested fallback to tab_space when unset, then verify both the default behavior and distinct Google-style values through the formatter's existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.