Hi, is there a way to remove special handling of `...
# intellij
j
Hi, is there a way to remove special handling of
java.*
imports for Kotlin files on Android Studio (IntelliJ) when sorting / optimizing imports? For Java files there is a “Preferences - Code Style - Java - Imports - Import Layout” where I can remove the special handling of
java.*
but for Kotlin I haven’t found a way to do it so I am continuously having issues with not properly sorted java imports when checking official Kotlin code style with ktlint.
5
j
doesn't look like it, we've disabled that ktlint rule for that reason: https://github.com/pinterest/ktlint/issues/527 https://youtrack.jetbrains.com/issue/KT-10974
j
Thanks for the issues. I will watch those for changes, seems the problem is known from long ago but nothing has been done. The current behavior seems like a pretty special case / preference which likely should not be a default or at least there should be an option to opt out of special handling of
java.*
. I was also wondering if there may be a way to disable that even if no UI exists for it, like by changing some configuration file.
a
We've run into the same issue. I'd be OK with a non-UI mechanism too for now. We'll have to disable our ktlint checks, but would love to have them in sync.
It seems like the second question is whether this formatting is the "desired" ordering?
j
It is not, at least not for Android, it is very clearly stated on the style guide to be ASCII sorted: https://developer.android.com/kotlin/style-guide#import_statements