-
Notifications
You must be signed in to change notification settings - Fork 508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could we get back the support for continuation indent? #816
Comments
probably we could use Unfortunately there is no standard |
Also, the indentation rule does not really support it in the current state I think |
@ZacSweers the problem is that the old indentation rule was pretty dumb and also did not support auto-formatting, it was just reporting some issues, so I guess these changes are not solely caused by the absence of the continuation indent support. I think we'd be happy to bring it back after the split of the indentation rule, but there are also some misalignments on JetBrains' side (e.g. #805) that have to be clarified first. |
I did a cursory glance around the changed files and ~99% of the couple dozen I checked were related to the continuation indent change. |
Interesting, could you drop a few examples? |
We could definitely consider this. Like @romtsn said, at the time the now-standard Indent rule was written, it greatly simplified the implementation to not support continuation indent. But if we're trying to converge on IDEA and ktlint formatting things the same, it does seem like something we need to support. |
Is there any progress on this issue? This seems to become a blocker for Kotlin 1.4.0. Our Square code style has a specific continuation indent that we don't like to drop. It would be sad if we'd need to disable the |
No progress so far, we were planning to split the rule itself first so it gets easier to disable and also change it. But it seems we need to prioritize it now. I am just curious, do you use continuation indent on some custom code blocks that are different from the official styleguide? By that I mean this: If the answer is yes, then we'd also need to bring support for this via editorconfig |
you can set a config rule to disable this check |
Unable to update Detekt because of this, which in turn is preventing us from updating to Kotlin 1.4. |
I guess this feature didn't make it into the |
No, planned for next release. |
@eygraber I have ktlint set up separately with kotlinter and I'm not leveraging the Detekt formatting plugin. When updating Detekt, a higher version of ktlint was brought in as a transitive dependency and broke the build. If you're in the same boat, then this temporary work-around could be helpful. If you're using the formatting plugin, you can try a similar strategy of forcing the versions of the transitive dependencies (and cross your fingers that it works.) These docs and the buildscript {
dependencies {
classpath("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$VERSION") {
exclude group: "com.pinterest.ktlint"
}
}
} Sorry for the off-topic, but I figured this might help what I suspect will be a growing amount of people arriving at these threads after completing some routine version bumps. I'm anxiously awaiting these changes :) |
@patrickpilch thanks for that. Unfortunately it wasn't able to help us. Wish this issue didn't keep getting bounced to future releases 😞 |
I think this may have been fixed? I updated to latest, removed the EDIT: Actually nevermind. Somehow it's passing locally but not on CI. I'm running ktlintCheck on both. Really unsure what's going on. Edit 2: Added back in the indent_size rule and CI now passes. No idea what's going on. |
Hey - 0.41.0 was released but doesn't mention this. We're seeing new issues when trying it out as well, where it fails due to expecting a larger continuation indent when we define 2. @ColtonIdle this issue is about continuation indent, |
As described here the continuation indent has been dropped in the default IntellI IDEA formatter. |
Enable the "Indentation" rule [1] [2] to ensure consistent indentation across the codebase. Change the continuation indent from 8 to 4 because the ktlint rule does not support continuation indents [3] [4]. [1]: https://detekt.dev/docs/rules/formatting#indentation [2]: https://pinterest.github.io/ktlint/0.50.0/rules/standard/#indentation [3]: pinterest/ktlint#816 [4]: https://kotlinlang.org/docs/code-style-migration-guide.html#differences-between-kotlin-coding-conventions-and-intellij-idea-default-code-style Signed-off-by: Martin Nonnenmacher <[email protected]>
Enable the "Indentation" rule [1] [2] to ensure consistent indentation across the codebase. Change the continuation indent from 8 to 4 because the ktlint rule does not support continuation indents [3] [4]. [1]: https://detekt.dev/docs/rules/formatting#indentation [2]: https://pinterest.github.io/ktlint/0.50.0/rules/standard/#indentation [3]: pinterest/ktlint#816 [4]: https://kotlinlang.org/docs/code-style-migration-guide.html#differences-between-kotlin-coding-conventions-and-intellij-idea-default-code-style Signed-off-by: Martin Nonnenmacher <[email protected]>
Enable the "Indentation" rule [1] [2] to ensure consistent indentation across the codebase. Change the continuation indent from 8 to 4 because the ktlint rule does not support continuation indents [3] [4]. [1]: https://detekt.dev/docs/rules/formatting#indentation [2]: https://pinterest.github.io/ktlint/0.50.0/rules/standard/#indentation [3]: pinterest/ktlint#816 [4]: https://kotlinlang.org/docs/code-style-migration-guide.html#differences-between-kotlin-coding-conventions-and-intellij-idea-default-code-style Signed-off-by: Martin Nonnenmacher <[email protected]>
It seems that ktlint v0.37.0 removed the support for continuation indent. Now all indents are 4 spaces. It would be great if there is a config option for it, so that we can make the decision for the projects.
The text was updated successfully, but these errors were encountered: