https://kotlinlang.org logo
#announcements
Title
# announcements
e

evanchooly

09/07/2017, 2:40 PM
@jw does KotlinPoet handle formatting the output?
j

jw

09/07/2017, 2:49 PM
What do you mean? It produces formatted code.
e

evanchooly

09/07/2017, 2:50 PM
well, the question is probably poorly formed. ironically.
but the output will group the properties together, and the functions in another, etc. with the indentation on the functions normalized, etc. ?
j

jw

09/07/2017, 3:06 PM
It groups, yes.
And it indents the structure but not the contents of functions
You're responsible for that using a CodeBlock which has indent/unindent methods.
And methods like control flow auto-indent
Basically check out the tests for examples
e

evanchooly

09/07/2017, 3:07 PM
ok. i have the same-ish issue in kibble. i was trying to decide if it made sense to use kotlinpoet for the generation and have kibble just add the parsing functionality on top.
j

jlleitschuh

09/07/2017, 3:26 PM
Or just run Ktlint on the output to format it when you are done generating it? https://ktlint.github.io/
e

evanchooly

09/07/2017, 3:27 PM
oooh. i was unaware of that one...
j

jlleitschuh

09/07/2017, 3:27 PM
Its the only one as far as I'm aware of.
j

jw

09/07/2017, 3:38 PM
I would be curious what you think isn't handled by KotlinPoet. I'm super annoyed that Dagger runs google-java-format after JavaPoet. It's a waste of time. I'd rather fix the tool to produce better output.
Please file bugs if you find things
e

evanchooly

09/07/2017, 3:40 PM
i'm of a similar mind with kibble. i try to produce the best output i can but I'd given some thought to an optional run of an external tool at the end. but i suppose that could be a build time concern/dependency rather than anything I need to worry about.
32 Views