Adding a comment with a single space (the space is important) at the end of a method chain in a Gradle build script will cause the code to be incorrectly formatted, making it appear as multi-line or folded instead of staying on one line.
Expected behavior:
Place this code at the very end of build.gradle.kts. Even an empty file containing only this code can reproduce the bug.
tasks.named("preBuild").dependsOn("test")
//
\
Actual behavior:
Inside build.gradle.kts
tasks
.named("preBuild")
.dependsOn(
"test")
// Removing this comment will make the formatting work as expected.
\
I tested this on an Android project using Spotless with Gradle.
Adding a comment with a single space (the space is important) at the end of a method chain in a Gradle build script will cause the code to be incorrectly formatted, making it appear as multi-line or folded instead of staying on one line.
Expected behavior: Place this code at the very end of
build.gradle.kts
. Even an empty file containing only this code can reproduce the bug.\ Actual behavior: Inside
build.gradle.kts
\ I tested this on an Android project using Spotless with Gradle.
My root
build.gradle.kts