https://kotlinlang.org logo
r

Rafs

06/21/2021, 9:13 PM
Is there any way of getting Android Studio to automatically format code in exactly the way ktlint does it? maybe a configuration XML file that we can import?
And then you can use the SaveActions plugins to format on save (https://plugins.jetbrains.com/plugin/7642-save-actions)
c

Colton Idle

06/22/2021, 4:21 AM
There's an unofficial ktlint IDE plugin in the plugin marketplace. Overall I've moved to ktfmt from facebook over ktlint. ktfmt repo includes an IJ plugin that takes over the default reformat key combo. and it focusses on a deteministic output. I love it 100x more than ktlint. Join #ktfmt if you're curious.
e

ephemient

06/24/2021, 12:26 AM
for what it's worth, Detekt uses ktlint for formatting rules (as well as adding many more rules) and has functional Gradle and IDE plugins. there's a compiler plugin too, which can help speed up your overall build by doing compile+lint in a single pass.
4 Views