Open JavierSegoviaCordoba opened 3 years ago
Interesting. Should this be applied to top-level only? or all lambdas in kts files?
I was doubting about that too. I think all code samples from Gradle will use lambdas in multiline, so initially I think all lambdas should do that (or at least all lambdas inside:
What do you think if a regex is used to do only in files which ends with gradle.kts
?
They can be at the root of a project, but in src/main/kotlin
too (precompiled plugins).
Definitely, I think this should be supported in some way.
I have disabled *kts
support but I am using it with the IDEA plugin to think a lot about this and I think it is really strange to see the Kotlin code so compacted in Gradle configurations except for the usuals (chaining lambda methods like map
).
The problem I see is how we can know if a lambda inside a Gradle file is for a Gradle configuration or it is, indeed, just a supplement method like I mentioned before.
Do you have something thought about this @cgrushko?
perhaps all top-level lambdas in kts files should be multiline?
Yeah, I think so too
I am trying in the 2021.1 the IDEA plugin with 0.20.
When I reformat the code in
.kts
files, I think some lambdas should be treated differently.For example
becomes
Should ktfmt have the same
.kt
behavior for.kts
files? It is strange to see a lot of usual config blocks in a single line.