Is indent_size handling in ktlint 1.0.0 different ...
# ktlint
k
Is indent_size handling in ktlint 1.0.0 different from 0.46.1? Tried to update and it seems to be weird for this case:
Copy code
sealed class T(val name: String) {
    sealed class C(
        name: String,
        val something: String,
    ) : T
        object Black : C(
*            name = "black",
*            something = "else",
        ) @
It wants the lines marked with "*" to be indented at 16 spaces instead of 12. We're using the default indentation which should be 4. ========== Multiline expresssions are also a bit weird... it wants
Copy code
fontFamily = when (fontFamily) {
to be formatted like this:
Copy code
fontFamily =
when (fontFamily) {
I would have expected it to at least indent the when in by 4 spaces... Edit: looks like first might be bug. Second is ok after I tried creating repro snippets. Snippets in 🧵
Snippet 1:
Copy code
sealed class T(val name: String) {
    sealed class C(
        name: String,
        val something: String,
    ) : T(name) {
        object Black : C(
            name = "black",
            something = "else",
        )
    }
}
Snippet 2:
Copy code
data class T(
    val fontSize: Int,
    val fontFamily: String,
)

class Test(val fontFamily: String) {
    val familyType: T
        get() =
            T(
                fontSize = 1,
                fontFamily =
                    when (fontFamily) {
                        "1" ->
                            "yes"
                        else ->
                            "no"
                    },
            )
}
The original code had "get() = T(" on the same line and when that was the case, it wanted the "when" at the same indentation as "fontFamily". But this violates the multiline expression rule, so "T(" should be on a separate line.