Add record component wrapping and method call argument alignment#6601
Merged
jkschneider merged 2 commits intomainfrom Jan 26, 2026
Merged
Add record component wrapping and method call argument alignment#6601jkschneider merged 2 commits intomainfrom
jkschneider merged 2 commits intomainfrom
Conversation
This adds support for IntelliJ-style formatting options requested by Scentbird: 1. Record Components (issue #1556): - Added WrappingAndBracesStyle.RecordComponents with wrap, alignWhenMultiline, openNewLine, and closeNewLine options - Added WrapRecordComponents visitor to apply wrapping rules - Integrated into WrappingAndBracesVisitor for class declarations - Added comprehensive tests 2. Method Call Arguments Alignment (issue #1558): - Added METHOD_INVOCATION_ARGUMENT and NEW_CLASS_ARGUMENTS handling in TabsAndIndentsVisitor.alignWhenMultiple() - This enables alignWhenMultiline for method call arguments Note: Issues #1555 (Chained Method Calls) and #1557 (Method Declaration Parameters) were already implemented - the style options for ChopIfTooLong, alignWhenMultiline, openNewLine, and closeNewLine already existed. Fixes moderneinc/customer-requests#1555 Fixes moderneinc/customer-requests#1556 Fixes moderneinc/customer-requests#1557 Fixes moderneinc/customer-requests#1558
Add missing RecordComponents parameter to constructor calls in rewrite-java-test module.
jkschneider
added a commit
that referenced
this pull request
Jan 26, 2026
* Add record component wrapping and method call argument alignment This adds support for IntelliJ-style formatting options requested: 1. Record Components (issue #1556): - Added WrappingAndBracesStyle.RecordComponents with wrap, alignWhenMultiline, openNewLine, and closeNewLine options - Added WrapRecordComponents visitor to apply wrapping rules - Integrated into WrappingAndBracesVisitor for class declarations - Added comprehensive tests 2. Method Call Arguments Alignment (issue #1558): - Added METHOD_INVOCATION_ARGUMENT and NEW_CLASS_ARGUMENTS handling in TabsAndIndentsVisitor.alignWhenMultiple() - This enables alignWhenMultiline for method call arguments Note: Issues #1555 (Chained Method Calls) and #1557 (Method Declaration Parameters) were already implemented - the style options for ChopIfTooLong, alignWhenMultiline, openNewLine, and closeNewLine already existed. Fixes moderneinc/customer-requests#1555 Fixes moderneinc/customer-requests#1556 Fixes moderneinc/customer-requests#1557 Fixes moderneinc/customer-requests#1558 * Fix WrappingAndBracesTest constructor calls Add missing RecordComponents parameter to constructor calls in rewrite-java-test module.
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
ChopIfTooLong,WrapAlways,openNewLine,closeNewLine,alignWhenMultiline)alignWhenMultiline)Problem
Solution
Record Components (new): Added
WrappingAndBracesStyle.RecordComponentsclass andWrapRecordComponentsvisitor to handle wrapping for Java record component lists, supportingChopIfTooLong,WrapAlways,openNewLine,closeNewLine, andalignWhenMultilineoptions.Method Call Argument Alignment (fixed): Added handling for
METHOD_INVOCATION_ARGUMENTandNEW_CLASS_ARGUMENTSinTabsAndIndentsVisitor.alignWhenMultiple()to enable alignment when multiline for method call arguments.Chained Method Calls & Method Declaration Parameters: These were already implemented. The style options for
ChopIfTooLong,alignWhenMultiline,openNewLine, andcloseNewLinealready existed in the codebase.Test plan
Existing tests pass
New tests added for record component wrapping (
WrapRecordComponentsTest)All
WrapMethod*Testtests pass with updated constructorsFixes moderneinc/customer-requests#1555
Fixes moderneinc/customer-requests#1556
Fixes moderneinc/customer-requests#1557
Fixes moderneinc/customer-requests#1558