-
Notifications
You must be signed in to change notification settings - Fork 512
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
Indentation class body when class has multiline super type list (ktlint_official only) #2115
Comments
… code style `ktlint_official` as it is inconsistent compared to other class bodies `indent` Closes #2115
* Fix indent of explicit constructor (also see #2115) * Fix error in `hasNewLineInClosedRange` and `noNewLineInClosedRange`
@paul-dingemans is this fixed for you now? For me Foo is still formatted as you mentioned it in your initial post. I would also prefer the formatting you suggested there. |
Can you be more specific? The original post contains multiple |
Giving my feedback on this topic, I find it quite strange that classes with annotated constructor causes the class body to have 2 indents. All of a sudden I find some classes with 2 tabs and others with 1 tab. Instead of all classes looking similar, it seems quite random and does not give a feel of coherent code formatting in the project. Usually one does not look at the class constructor. Additionally because of the 2 tabs indent some lines now reach the max length and are formatted completely different, even though it's the same code within the same amount of scope levels. |
Please see for similar feedback and backgrounds of this change in #2138. |
Has this regressed? In 1.2.1 I have a class that was formatted to:
But I expect it (and so does intellij kotlin formatter) to be:
|
This is not a regression bug but an intentional change in the |
#1916 fixed the wrapping of an explicit constructor for code style
ktlint_official
. Code like below:is formatted as:
The identation of the class body however is unwanted as it also affects classes not using the explicit
constructor
keyword.Example:
is formatted with
0.50.0
as:while it would be expected that the original format was kept.
Also classes having an explicit
constructor
and a long super type list are not indented correctly:is formatted as:
The text was updated successfully, but these errors were encountered: