Skip to content

fmt: set prefer_compact to "none" - #73

Merged
PaulRBerg merged 1 commit into
PaulRBerg:mainfrom
eltociear:fmt-prefer-compact-none
Jul 30, 2026
Merged

fmt: set prefer_compact to "none"#73
PaulRBerg merged 1 commit into
PaulRBerg:mainfrom
eltociear:fmt-prefer-compact-none

Conversation

@eltociear

Copy link
Copy Markdown
Contributor

Closes #68.

Sets the [fmt] option that replaced the deprecated call_compact_args, to the value suggested in foundry-rs/foundry#4024 (comment).

What it changes

prefer_compact defaults to "all", which first tries to pack a broken list onto a single continuation line. "none" keeps one element per line instead, which matches multiline_func_header = "all" and is the style asked for in #4024:

// prefer_compact = "all"  (today's default)
event ProceedsSettled(
    uint256 alphaValue, uint256 betaValue, uint256 gammaValue, uint256 deltaValue
);

// prefer_compact = "none"
event ProceedsSettled(
    uint256 alphaValue,
    uint256 betaValue,
    uint256 gammaValue,
    uint256 deltaValue
);

Placed alphabetically between number_underscore and quote_style to match the rest of the block.

Verification

Run against forge 1.7.1 (stable — what foundry-rs/foundry-toolchain@v1 installs by default; the option is absent from v1.4.0 and earlier):

  • forge config reports prefer_compact = "none", so the key is recognised.
  • forge fmt --check exits 0, so bun run full-check is unaffected.
  • forge fmt rewrites none of the five .sol files. No source churn — none of them currently has a list long enough to break at line_length = 120, so this only shapes the code template users write later, which is the point.

One gap worth flagging

The option takes effect for event and error declarations, emit and revert — but it does not appear to affect plain function calls. Minimal repro, identical on 1.7.1 and 1.7.2-nightly:

[fmt]
  line_length = 100
  prefer_compact = "none"   # same output for "all" and "calls"
function go() external {
    settleTheSwapAndForwardTheProceeds(alphaValue, betaValue, gammaValue, deltaValue, epsilonValue);
}

All three values produce byte-identical output (the args stay packed on one continuation line), even though PreferCompact::calls() is matches!(self, All | Calls). Since #4024 asks to "stick to the same multiline format everywhere", that may be worth raising upstream — it is not something this repo can fix, and it does not affect the value of setting the option here.

🤖 Generated with Claude Code

Keeps events, errors, emit and revert on the same one-per-line multiline
style as multiline_func_header = "all", rather than packing a broken list
onto a single continuation line.

Closes PaulRBerg#68.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@PaulRBerg
PaulRBerg merged commit 0202514 into PaulRBerg:main Jul 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update [fmt] config

2 participants