https://kotlinlang.org logo
#ktlint
Title
# ktlint
j

Johan

09/27/2023, 1:37 PM
What is the best way to sync intellij format code the same way as ktlint does? I use, schema: project and default from “Kotlin Coding conventions” When formatting code in intellij, the code in a class gets wrapped at 120 chars At the sime time it seems that ktlint doesn’t do anything, even if the max length should be 100 per defaut
p

Paul Dingemans

09/27/2023, 4:21 PM
What version of ktlint are you using? Do you have an .editorconfig file?
j

Johan

09/27/2023, 4:24 PM
0.50.0 without any configfile. I have a config file in one of my projects but it's empty. Same thing happens in a gradle and maven project
p

Paul Dingemans

09/27/2023, 4:48 PM
Ok, if you don’t have any
.editorconfig
file than
0.50.0
defaults to code style
intellij_idea
which does not have a default max line length. The default maxline length
100
is used by code style
android_studio
. Note that default code style is changed in
1.0.0
to
ktlint_official
. Read more about code styles on https://pinterest.github.io/ktlint/0.50.0/rules/code-styles/