nbadal / ktlint-intellij-plugin

Ktlint plugin for IntelliJ IDEA + Android Studio
MIT License
158 stars 23 forks source link

Information about file missing in notifcation #382

Closed Vampire closed 9 months ago

Vampire commented 9 months ago

I reformatted all files in a project (just a handful) using ktlint plugin 0.20.0-beta-4 and got two "Parsing error" notifications with the text

This file can not be parsed by ktlint. Please resolve all (compilation) errors first. Error: 11:1 Expecting a top level declaration

Besides that this is not true, according to the Kotlin compiler (will report separately when I find out what it dislikes), there is no way to find out what file it actually has a problem with, not even in the IntelliJ log file.

Please contain information about the file that is problematic in the notification.

paul-dingemans commented 9 months ago

Good remark.

Could it be that the files which were incorrectly reported to contain compilation error are kotlin script files? If so, do those files contain statement (not being a declaration) at the top level? For example:

val foo = "foo"

if (foo == "bar") {
    println("impossible")
}
Vampire commented 9 months ago

Could it be that the files which were incorrectly reported to contain compilation error are kotlin script files?

Yes, they were the Gradle build script and the Gradle settings script.

If so, do those files contain statement (not being a declaration) at the top level? For example:

No, they don't. But with 0.20.0-beta-5 it also works now, thx.