https://kotlinlang.org logo
Title
k

kenkyee

11/27/2018, 2:16 PM
For constructor param indentation when each is on a separate line, is it supposed to be 4 or 8? Android studio defaults to 8 but ktlint flags it as 4...
m

Mike

11/27/2018, 4:49 PM
In IDEA, there’s an option in code style to set it to the Kotlin Style guide. The IntelliJ default isn’t quite the same (or perhaps in latest updates, they’ve made it match). So as part of developer setup, everyone is told to update their code style to Kotlin style guide. Once you choose Kotlin in Code Style, does Android studio have a
Set from...
option in top-right? If so, hopefully there’s a
predefined styles
option and the Kotlin style guide is there. If you can convince the whole team to update, you can then have everyone use reformat code in the IDE, and turn that option on in the commit dialog. Reduces the number of diffs that are whitespace/formatting only
k

kenkyee

11/27/2018, 7:21 PM
we do have a team android studio config...I modified it there 🙂
m

Mike

11/27/2018, 8:55 PM
In intellij, the ide also has the kotlin published conventions predefined as a code style and you can reset the current to be that. So no need for a separately maintained config. But sounds like you have it under control
k

kenkyee

11/27/2018, 11:06 PM
Yep...we've got other tweaks... Thanks
b

bdawg.io

12/08/2018, 10:34 PM
The kotlin style guide says
Use regular indent (4 spaces) for constructor parameters.