nbadal / ktlint-intellij-plugin

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

Caret at wrong position for violations that are preceded by other violations that can be autocorrected #415

Closed paul-dingemans closed 8 months ago

paul-dingemans commented 8 months ago

Given code below:

fun foo(a: String, b: String, c: String) =
    a.plus(b).plus(c)

with .editorconfig:

root = true

[*.{kt,kts}]
ktlint_code_style = kotlin_official
ktlint_standard = enabled
ktlint_experimental = enabled

shows following violations: Screenshot 2023-12-19 at 17 16 04

The highlighted error regarding the 'First line of the body expression` displays the caret at the wrong position. It should have shown the caret at the end of line 1. This problem only occurrs when the violation is preceded by certain other violations that can be autocorrected by ktlint.