|
27 | 27 | import org.openrewrite.style.Style; |
28 | 28 |
|
29 | 29 | import java.util.Optional; |
30 | | -import java.util.function.Supplier; |
31 | 30 |
|
32 | 31 | import static org.openrewrite.java.format.AutodetectGeneralFormatStyle.autodetectGeneralFormatStyle; |
33 | 32 |
|
@@ -58,17 +57,20 @@ public J visit(@Nullable Tree tree, P p, Cursor cursor) { |
58 | 57 | t = new WrappingAndBracesVisitor<>(Style.from(WrappingAndBracesStyle.class, cu, IntelliJ::wrappingAndBraces), stopAfter) |
59 | 58 | .visit(t, p, cursor.fork()); |
60 | 59 |
|
| 60 | + TabsAndIndentsStyle tabsAndIndentsStyle = Style.from(TabsAndIndentsStyle.class, cu, IntelliJ::tabsAndIndents); |
| 61 | + SpacesStyle spacesStyle = Style.from(SpacesStyle.class, cu, IntelliJ::spaces); |
| 62 | + |
61 | 63 | t = new SpacesVisitor<>( |
62 | | - Style.from(SpacesStyle.class, cu, IntelliJ::spaces), |
| 64 | + spacesStyle, |
63 | 65 | cu.getStyle(EmptyForInitializerPadStyle.class), |
64 | 66 | Style.from(EmptyForIteratorPadStyle.class, cu), |
65 | 67 | stopAfter |
66 | 68 | ).visit(t, p, cursor.fork()); |
67 | 69 |
|
68 | | - t = new NormalizeTabsOrSpacesVisitor<>(Style.from(TabsAndIndentsStyle.class, cu, IntelliJ::tabsAndIndents), stopAfter) |
| 70 | + t = new NormalizeTabsOrSpacesVisitor<>(tabsAndIndentsStyle, stopAfter) |
69 | 71 | .visit(t, p, cursor.fork()); |
70 | 72 |
|
71 | | - t = new TabsAndIndentsVisitor<>(Style.from(TabsAndIndentsStyle.class, cu, IntelliJ::tabsAndIndents), stopAfter) |
| 73 | + t = new TabsAndIndentsVisitor<>(tabsAndIndentsStyle, spacesStyle, stopAfter) |
72 | 74 | .visit(t, p, cursor.fork()); |
73 | 75 |
|
74 | 76 | t = new NormalizeLineBreaksVisitor<>(Optional.ofNullable(Style.from(GeneralFormatStyle.class, cu)) |
|
0 commit comments