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

eygraber

09/21/2022, 6:03 AM
When I say properly implemented, I mean implemented and not constantly taken out and put back in. The feature used to be implemented, and worked for me. Was there a reason it was removed, or would using that code again suffice?
e

ephemient

09/21/2022, 6:21 AM
what do you mean "constantly taken out and put back in"? it's been taken out once and never put back in.
s

Sha Sha Chu

09/21/2022, 3:31 PM
That's correct; it was taken out several years ago and never put back in. That said there are a number of rules that affect indentation so it's possible it looks like continuation indent is or isn't implemented. But it's not from the base indent rule.
e

eygraber

09/21/2022, 4:11 PM
There have definitely been multiple issues with the base indent rule itself and a continuation indent over the years. But it was working well for me lately with a hardcoded 2 space continuation indent at all levels. However, after updating to detekt 1.22.0-RC1 all of my continuation indents are failing the base indent rule because it's expecting the continuation indent to be double the size of the previous level, and that was not the case before. 1.22.0-RC1 updates ktlint from 0.45.2 to 0.46.1
p

Paul Dingemans

09/21/2022, 6:39 PM
As described here the continuation index has also been dropped in IntelliJ IDEA formatter. That is why the continuation story has been closed without resolving
Ok, my wording was not entirely accurate. But I do believe that following the recommendation is effectively the same as having no continuation indent. To ensure compatibility with ktlint it is best to use the “set from” option in this screen and then select ” Kotlin style guide”.
e

eygraber

09/21/2022, 8:33 PM
So maybe it's a terminology thing and there is no such thing as a continuation indent anymore, rather a single indent should be used for lines that are a continuation? In any case there is still some disconnect, where Kotlin is saying to use a single indent on a continuation, but ktlint is using a double indent. I would expect that if my
indent_size
is
2
, then that same value would be used for continuation lines instead of
4
. Should I file a bug on GitHub for this?
p

Paul Dingemans

09/22/2022, 6:29 PM
Yeah, please file an issue for this specific case. I expect this is a tab-space-tab issue. Indenting with spaces is typically done with 4 spaces. So it might well be that the indent of 4 spaces is translated into two tabs because of your
indent_size
. Please include code sample and
.editorconfig
settings.
15 Views