if you use non-breaking spaces (<https://square.gi...
# squarelibraries
j
if you use non-breaking spaces (https://square.github.io/kotlinpoet/#spaces-wrap-by-default) everywhere on your first line it should/might wrap after the equals sign
l
Oh wow thanks! Also, the indentation afterwards is kinda weird:
Copy code
context(Transaction)
public fun TestTable.updateTestTableById(parameter: Int, dto: TestTableDTO): Int =
    update({ id eq parameter }) { statement ->
  statement[id] = requireNotNull(dto.id) { "TestTableDTO.$id is null" }
  statement[name] = requireNotNull(dto.name) { "TestTableDTO.$name is null" }
  statement[surname] = dto.surname
  statement[aLong] = requireNotNull(dto.aLong) { "TestTableDTO.$aLong is null" }
}
is there a way to reindent correctly?
j
Unfortunately, no
l
Alright, thanks anyway 🙂
j
If you care deeply about the generated code's format we recommend post-processing with a formatter like IntelliJ or ktlint
l
Indeed that is what I am going to do! I will postprocess the generated code with klint i believe
j
I recommend rewriting your generated code to be less dense, and to skip ktlint. That way your builds will be faster and your line wrapping won’t be that bad.
Adding ktlint to run at the end of KotlinPoet is often the source of slow builds; or at least that was the case for Dagger
(their problem was JavaPoet + Google Java Format, but the performance problem had the same structure. Formatting generated code while the user is waiting on a build isn’t great)