Correct string block indent#6694
Conversation
|
@timtebeek this is to support autoformat for text blocks where idents are not spaces. Looks like the code currently is biased towards spaces based indents. The indent for multiline string is parent AST node indent + 2 indents - this seesm to be the same to JDT and IntelliJ. |
timtebeek
left a comment
There was a problem hiding this comment.
Thanks for the immediate suggested fix! @Jenson3210 is our expert here, but this looks alright to me already. I'll merge before tomorrow's release if I don't hear from him before then. If he sees this and agrees he can immediately merge.
|
@timtebeek i see there is a test failure for aligned text blocks. Trying to figure it out... I don't know why we're making a check |
|
Okay, I think i came up with a good fix for the alignment things. Should be good to go now |
rewrite-java/src/main/java/org/openrewrite/java/format/TabsAndIndentsVisitor.java
Outdated
Show resolved
Hide resolved
rewrite-java/src/main/java/org/openrewrite/java/format/TabsAndIndentsVisitor.java
Outdated
Show resolved
Hide resolved
rewrite-java/src/main/java/org/openrewrite/java/format/TabsAndIndentsVisitor.java
Outdated
Show resolved
Hide resolved
rewrite-java/src/main/java/org/openrewrite/java/format/TabsAndIndentsVisitor.java
Outdated
Show resolved
Hide resolved
rewrite-java/src/main/java/org/openrewrite/java/format/TabsAndIndentsVisitor.java
Show resolved
Hide resolved
rewrite-java-test/src/test/java/org/openrewrite/java/format/TabsAndIndentsTest.java
Outdated
Show resolved
Hide resolved
rewrite-java-test/src/test/java/org/openrewrite/java/format/TabsAndIndentsTest.java
Outdated
Show resolved
Hide resolved
|
@BoykoAlex, thanks for identifying this gap! I made some suggestions which I think will make the code behave even more accurate. Let me know if you have thoughts here. |
…IndentsVisitor.java Co-authored-by: Jente Sondervorst <jentesondervorst@gmail.com>
…IndentsVisitor.java Co-authored-by: Jente Sondervorst <jentesondervorst@gmail.com>
…IndentsVisitor.java Co-authored-by: Jente Sondervorst <jentesondervorst@gmail.com>
…bsAndIndentsTest.java Co-authored-by: Jente Sondervorst <jentesondervorst@gmail.com>
…bsAndIndentsTest.java Co-authored-by: Jente Sondervorst <jentesondervorst@gmail.com>
|
@Jenson3210 thank you for the review :-) |
Jenson3210
left a comment
There was a problem hiding this comment.
Great! Thanks a lot for the issue/troubleshooting/fix here!
|
Quick note that we're seeing two failures downstream that I think are related: https://ge.openrewrite.org/s/gtr3ruly7ncng Could either of you have a look? I want to prevent us having to field related questions after today's release. |
String blocks autoformat is based on spaces rather than whatever is in the style.