Hi there, I'm struggling a lot with ktlint when trying to format my code. If I run an Android Studio code reformat of a long if statement, it formats the if as Kotlin Official Code Style, however ktlint complains about an unexpected indentation:
if (records.containsKey(AdvRecord.TYPE_UUID128) && Arrays.equals(
Config.MYOWN_GATT_SERVICE_RAW, // <-- Unexpected indentation (expected 12, actual 16)
AdvRecord.getServiceUUID128(records[AdvRecord.TYPE_UUID128]!!) // <-- Same as above
) // <-- Unexpected indentation (expected 8, actual 12)
) {
...
}
However, if I change manually to the expected result,
ktlintFormat
complains about the same lines to be changed into the previous code indentation again. I don't understand anything. What I'm trying to achieve is Android Studio IDE code reformat fits with ktlint criteria, and somehow they're unsynced now. I'm using the latest gradle plugin:
id "org.jlleitschuh.gradle.ktlint" version "9.4.1"
I have even tried to run
ktlint --android applyToIDEAProject
to apply project specific code style, but the problem persist. Any idea how to solve this guys?