Commit c0589e4
committed
Add record component wrapping and method call argument alignment (#6601)
* 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.1 parent ce325fc commit c0589e4
10 files changed
Lines changed: 529 additions & 0 deletions
File tree
- rewrite-java-test/src/test/java/org/openrewrite/java/format
- rewrite-java/src
- main/java/org/openrewrite/java
- format
- style
- test/java/org/openrewrite/java/format
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
938 | 939 | | |
939 | 940 | | |
940 | 941 | | |
| 942 | + | |
941 | 943 | | |
942 | 944 | | |
943 | 945 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
563 | 563 | | |
564 | 564 | | |
565 | 565 | | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
566 | 572 | | |
567 | 573 | | |
568 | 574 | | |
| |||
Lines changed: 113 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
199 | 203 | | |
200 | 204 | | |
201 | 205 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| |||
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
| |||
146 | 156 | | |
147 | 157 | | |
148 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
149 | 188 | | |
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
449 | 450 | | |
450 | 451 | | |
451 | 452 | | |
| 453 | + | |
452 | 454 | | |
453 | 455 | | |
454 | 456 | | |
| |||
544 | 546 | | |
545 | 547 | | |
546 | 548 | | |
| 549 | + | |
547 | 550 | | |
548 | 551 | | |
549 | 552 | | |
| |||
619 | 622 | | |
620 | 623 | | |
621 | 624 | | |
| 625 | + | |
622 | 626 | | |
623 | 627 | | |
624 | 628 | | |
| |||
696 | 700 | | |
697 | 701 | | |
698 | 702 | | |
| 703 | + | |
699 | 704 | | |
700 | 705 | | |
701 | 706 | | |
| |||
757 | 762 | | |
758 | 763 | | |
759 | 764 | | |
| 765 | + | |
760 | 766 | | |
761 | 767 | | |
762 | 768 | | |
| |||
835 | 841 | | |
836 | 842 | | |
837 | 843 | | |
| 844 | + | |
838 | 845 | | |
839 | 846 | | |
840 | 847 | | |
| |||
899 | 906 | | |
900 | 907 | | |
901 | 908 | | |
| 909 | + | |
902 | 910 | | |
903 | 911 | | |
904 | 912 | | |
| |||
957 | 965 | | |
958 | 966 | | |
959 | 967 | | |
| 968 | + | |
960 | 969 | | |
961 | 970 | | |
962 | 971 | | |
| |||
1034 | 1043 | | |
1035 | 1044 | | |
1036 | 1045 | | |
| 1046 | + | |
1037 | 1047 | | |
1038 | 1048 | | |
1039 | 1049 | | |
| |||
1086 | 1096 | | |
1087 | 1097 | | |
1088 | 1098 | | |
| 1099 | + | |
1089 | 1100 | | |
1090 | 1101 | | |
1091 | 1102 | | |
| |||
1139 | 1150 | | |
1140 | 1151 | | |
1141 | 1152 | | |
| 1153 | + | |
1142 | 1154 | | |
1143 | 1155 | | |
1144 | 1156 | | |
| |||
1188 | 1200 | | |
1189 | 1201 | | |
1190 | 1202 | | |
| 1203 | + | |
1191 | 1204 | | |
1192 | 1205 | | |
1193 | 1206 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
603 | 604 | | |
604 | 605 | | |
605 | 606 | | |
| 607 | + | |
606 | 608 | | |
607 | 609 | | |
608 | 610 | | |
| |||
649 | 651 | | |
650 | 652 | | |
651 | 653 | | |
| 654 | + | |
652 | 655 | | |
653 | 656 | | |
654 | 657 | | |
| |||
680 | 683 | | |
681 | 684 | | |
682 | 685 | | |
| 686 | + | |
683 | 687 | | |
684 | 688 | | |
685 | 689 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
506 | 507 | | |
507 | 508 | | |
508 | 509 | | |
| 510 | + | |
509 | 511 | | |
510 | 512 | | |
511 | 513 | | |
| |||
558 | 560 | | |
559 | 561 | | |
560 | 562 | | |
| 563 | + | |
561 | 564 | | |
562 | 565 | | |
563 | 566 | | |
| |||
593 | 596 | | |
594 | 597 | | |
595 | 598 | | |
| 599 | + | |
596 | 600 | | |
597 | 601 | | |
598 | 602 | | |
| |||
0 commit comments