Commit 8bf9f21
Refactored autoFormat and added MethodInvocation argument wrapping
* Refactor the Wrap-/ChopIfTooLong to use MinimizationVisitor to correctly count Method chain / Declaration length
* Added more coverage to the MinimizationVisitor and fixed a bug in TryResource visitor not returning updated prefixes and markers
* Added more tests for all intelliJ Spaces settings style coverage
* Last fixes
* Implement MethodCall Argument wrapping
* Added tests for Method Invocation Wrapping
* Split up the PR as it gets too big to review.
* Refactor formatting to do a single edit to the tree's prefix/suffixes if needed.
This allows for ChopIfTooLong and WrapIfLong to expect that parent objects will be formatted correctly during calculation of the wrapping phase.
This also allows for formatting to remove additional enters which are introduced between items that should not have an enter in between.
While this is in line with how auto-code-formatters behave (ignore if comment is present eg.), the impact downstream might be big in a lot of unit tests as they expect a certain style.
* Remove files
* private again
* remove changes to SpacesStyle
* eof
* reset test
* remove unused method
* revert test changes
* eof
* review comments auto-bot
* Fix 3 out of 4 failing tests
* Rework Groovy visitor and Kotlin visitor to same concepts
* bot comments
* bot comments
* fix case label suffix from disappearing
* fix case label suffix from disappearing
* fix case label suffix from disappearing + improved test coverage for 2 missed cases
* Groovy specific SpacesVisitor
* Fixed failing tests
* Fixed failing tests
* bot
* tests
* altered expectation to match intelliJ
* Review comment
* Remove unused package declarations
* Remove more unused package declarations
* Review comment
* Add Nullable to reduce warning count
* Reduce impact downstream compilation
---------
Co-authored-by: Tim te Beek <tim@moderne.io>1 parent cdf1a7a commit 8bf9f21
50 files changed
Lines changed: 11608 additions & 2716 deletions
File tree
- rewrite-core/src/main/java/org/openrewrite/style
- rewrite-groovy/src
- main/java/org/openrewrite/groovy/format
- test/java/org/openrewrite/groovy/format
- rewrite-java-test/src/test/java/org/openrewrite/java
- format
- rewrite-java/src
- main/java/org/openrewrite/java
- format
- service
- style
- test/java/org/openrewrite/java/format
- rewrite-kotlin/src/main/java/org/openrewrite/kotlin/format
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 32 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 27 | + | |
30 | 28 | | |
31 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | | - | |
| 61 | + | |
61 | 62 | | |
62 | | - | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
122 | 131 | | |
123 | 132 | | |
124 | 133 | | |
| |||
139 | 148 | | |
140 | 149 | | |
141 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
142 | 168 | | |
Lines changed: 12 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | 25 | | |
33 | 26 | | |
34 | 27 | | |
| |||
49 | 42 | | |
50 | 43 | | |
51 | 44 | | |
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 | | - | |
| 45 | + | |
80 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
81 | 55 | | |
| 56 | + | |
82 | 57 | | |
83 | | - | |
84 | | - | |
85 | | - | |
| 58 | + | |
| 59 | + | |
86 | 60 | | |
87 | 61 | | |
0 commit comments