Open aholland opened 6 months ago
Hi @aholland ; thanks for pointing that out! Yes indeed we should not convert to text blocks when there's comments; a case currently missed in UseTextBlocks https://github.com/openrewrite/rewrite-migrate-java/blob/d12d72bed27b6f183fbd7a37e6d6b3cead30411b/src/main/java/org/openrewrite/java/migrate/lang/UseTextBlocks.java#L46
If you'd want to help out retain comments the quickest way is likely to add a draft PR with a new test, based on this existing test, but with a comment thrown in somewhere in the middle. Ideally we convert none of it to text blocks. https://github.com/openrewrite/rewrite-migrate-java/blob/d12d72bed27b6f183fbd7a37e6d6b3cead30411b/src/test/java/org/openrewrite/java/migrate/lang/UseTextBlocksTest.java#L47-L70
Your second comment of ending up with trailing slashes in SQL queries is maybe best handled with a run of our Format SQL recipe: https://docs.openrewrite.org/recipes/sql/formatsql. I think that ought to already introduce newlines, as seen in the tests.
Hi - there are two problems with the way text blocks are being created, illustrated in this image.
\
. I admit this might be hard to detect and do correctly and reliably. Perhaps there could be an option though.This bug report is really about 1.
I am using the Gradle plugin, version 6.6.4.