We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Consider the following code:
package de.uni_freiburg.inatech.streem.feature_analyzer.view.option_modules class ClassWithMultilineConstructor @Deprecated( "Constructor must only be called by JavaFX.", ReplaceWith("ClassWithMultilineConstructor.newInstance()"), DeprecationLevel.ERROR ) constructor() { private val stringMember = "Hello there" fun someMethod() { println("Hello there") } companion object { fun newInstance(): ClassWithMultilineConstructor { println("Method in the companion object called") return ClassWithMultilineConstructor::class.java.getDeclaredConstructor().newInstance() } } }
The annotation and constructor have to be wrapped this way or else the max line length would be reached.
KtLint wants the entire class to be indented by one more tab, which not only looks ugly but also fights IntelliJ:
ClassWithMultilineConstructor.kt:4:1: Unexpected indentation (0) (should be 4) (standard:indent) ClassWithMultilineConstructor.kt:5:1: Unexpected indentation (4) (should be 8) (standard:indent) ClassWithMultilineConstructor.kt:6:1: Unexpected indentation (4) (should be 8) (standard:indent) ClassWithMultilineConstructor.kt:7:1: Unexpected indentation (4) (should be 8) (standard:indent) ClassWithMultilineConstructor.kt:8:1: Unexpected indentation (0) (should be 4) (standard:indent) ClassWithMultilineConstructor.kt:9:1: Unexpected indentation (0) (should be 4) (standard:indent) ClassWithMultilineConstructor.kt:10:1: Unexpected indentation (4) (should be 8) (standard:indent) ClassWithMultilineConstructor.kt:12:1: Unexpected indentation (4) (should be 8) (standard:indent) ClassWithMultilineConstructor.kt:13:1: Unexpected indentation (8) (should be 12) (standard:indent) ClassWithMultilineConstructor.kt:14:1: Unexpected indentation (4) (should be 8) (standard:indent) ClassWithMultilineConstructor.kt:16:1: Unexpected indentation (4) (should be 8) (standard:indent) ClassWithMultilineConstructor.kt:17:1: Unexpected indentation (8) (should be 12) (standard:indent) ClassWithMultilineConstructor.kt:18:1: Unexpected indentation (12) (should be 16) (standard:indent) ClassWithMultilineConstructor.kt:19:1: Unexpected indentation (12) (should be 16) (standard:indent) ClassWithMultilineConstructor.kt:20:1: Unexpected indentation (8) (should be 12) (standard:indent) ClassWithMultilineConstructor.kt:21:1: Unexpected indentation (4) (should be 8) (standard:indent) ClassWithMultilineConstructor.kt:22:1: Unexpected indentation (0) (should be 4) (standard:indent)
If I remove the @Deprecated annotation and the constructor() keyword (thus having the entire class signature on one line), the issue goes away.
@Deprecated
constructor()
Run KtLint 1.0.0 on the previous code sample (0.50.0 did not have this issue).
.editorconfig
indent_size = 4 indent_style = space insert_final_newline = true max_line_length = 120 tab_width = 4 ij_continuation_indent_size = 4
The text was updated successfully, but these errors were encountered:
It seems like this is related to #2115 .
Sorry, something went wrong.
Duplicate of #2138
No branches or pull requests
Expected Behavior
Consider the following code:
The annotation and constructor have to be wrapped this way or else the max line length would be reached.
Observed Behavior
KtLint wants the entire class to be indented by one more tab, which not only looks ugly but also fights IntelliJ:
If I remove the
@Deprecated
annotation and theconstructor()
keyword (thus having the entire class signature on one line), the issue goes away.Steps to Reproduce
Run KtLint 1.0.0 on the previous code sample (0.50.0 did not have this issue).
Your Environment
.editorconfig
settings:The text was updated successfully, but these errors were encountered: