https://kotlinlang.org logo
#ktfmt
Title
# ktfmt
c

christophsturm

10/15/2023, 6:38 PM
why does ktfmt change the formatting of this kdoc:
Copy code
/**
- * Lifecycle functions for resources that are used by tests.
- * This is a separate interface because it is available in the ContextDSL and in the TestDSL
+ * Lifecycle functions for resources that are used by tests. This is a separate interface because it
+ * is available in the ContextDSL and in the TestDSL
  */
I think the first version is more readable because each sentence has its own line.
c

Colton Idle

10/16/2023, 9:36 AM
I think ktfmt uses tor norbyes kdoc formatter https://github.com/tnorbye/kdoc-formatter
👍 1
i suppose you can ask the question right there in its issue tracker
by the looks of it. it does format it the way i would assume it should be formatted IMO.
c

christophsturm

10/16/2023, 9:39 AM
thanks! maybe you are right that its better that way. I just thought that if it takes 2 lines anyway the two sentences could be on separate lines.
c

Colton Idle

10/16/2023, 9:42 AM
Maybe if you put an extra blank line in between them then it wouldn't reformat?
👍 1
c

christophsturm

10/16/2023, 6:48 PM
btw it seems ktfmt really uses kdoc-formatter but by copying the source code instead of as a dependency.
and you are right, adding an extra blank line will stop the reformatting.
c

Colton Idle

10/16/2023, 6:58 PM
ooh. interesting!