Indent nested method-call argument lists (#591)#1673
Merged
eric-milles merged 1 commit intoMay 14, 2026
Conversation
When a method call's argument list spans multiple lines and is itself nested inside another paren, the inner arguments now receive an additional indentationMultiline step. Outermost paren-wraps are still handled by the existing multiline-statement rule, so test fixtures with a single wrap level (e.g. MultilineStatements1, MultilineStatements3, MultilineMethodParams*) are unchanged. see groovy#591
Member
|
I'm not sure how far the pattern of a separate method for each kind of wrapping is going to be doable. But thank you for your contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #591. Adds extra indentation for nested method-call argument lists whose contents start on a line after the opening paren.
For a multiline statement like
the existing formatter applies a single multiline indent to every continuation line, so
"x"andm1()(insidem2(...)) end up at the same column as.append(...)from the outer chain. The newhandleNestedParenWrapspass inGroovyIndentationwalks the tokens and, for each paren pair thatadds another
indentationMultilinestep to the lines it spans. The outermost wrap is left to the existing multiline-statement rule, so the single-level fixtures (MultilineStatements1/3,MultilineMethodParams*, etc.) are unchanged.