-
Notifications
You must be signed in to change notification settings - Fork 506
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
Comments above annotations are separated by the annotation with a blank line #2416
Comments
I can not reproduce the problem with any of the code styles. Can you please run command like |
Ah sorry, the example was too minimal, I updated the original description |
It looks like this behavior was added due to https://youtrack.jetbrains.com/issue/KT-35106. For backwards compatibilty this rule should be kept around. When you run ktlint with formatting, you see output below:
Based on this output you can decide to disable the rule in the |
But shouldn't the comment be above the comment, so like
? Having it like that upfront also makes ktlint happy and not change it. |
Given that I provide code below:
to ktlint command
So I am confused what you mean. Isn't this exactly what you expect? |
Yes, but not what I get. val gradle = gradle as ExtensionAware
// work-around for https://youtrack.jetbrains.com/issue/KT-38871
// Kotlin 1.9+ and thus Gradle 8.3+ fixed it and no suppression is necessary anymore
@Suppress("UNUSED_VARIABLE")
val foo by gradle.extra {
true
} |
Argh, I'm really bad at knitting MCVEs today. |
Ok, now the bug can be reproduced with code:
|
…n which is preceded by comment Closes #2416
Given code like
or
If you reformat those snippets with default settings / empty editorconfig, in both cases there is a blank line added between the comment and the annotation, while I do not find any rule in the coding guidelines that suggests an annotation has to be preceeded by a blank line and it seems natural that those comments refer to the following line.
The rule triggering this is
Your Environment
.editorconfig
settings: nothingThe text was updated successfully, but these errors were encountered: