nbadal / ktlint-intellij-plugin

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

.editorconfig is somehow cached #403

Closed Vampire closed 9 months ago

Vampire commented 9 months ago

With 0.20.0-beta-5 the .editorconfig somehow seems to be cached. I changed the content and triggered a reformat, but still the old settings were used. When using the ktlint CLI, the new setting takes effect. Triggering a reformat again in IntelliJ still uses the old settings.

In this concrete case I changed the value of ktlint_function_signature_body_expression_wrapping.

paul-dingemans commented 9 months ago

The .editorconfig is cached by KtlintRuleEngine of ktlint. The intellij plugin reuses the same instance of the KtlintRuleEngine when possible. Changes of .editorconfig are detected and accounted for, except for files which are already open in the editor. This needs fixing.

Vampire commented 9 months ago

Just to make sure, because the message of the fixing PR does not sound to me like it should fix the issue here. I did do a reformat of the file by triggering the reformat action manually and it used the old state. I could even do format on commandline and get the new version then format in IDE and get the old version again.

paul-dingemans commented 9 months ago

I am confident that it is solved. Please try again with next beta version when available.

Vampire commented 6 months ago

I think this still happens. I have a file open and it displays violations. I change .editorconfig to have an empty value for a key. Violation is still displayed. I fix the violation. I reintroduce the violation. Violation is shown again. I close the file and reopen it, violation is still shown. I close the project (not the IDE) and reopen it, violation is still shown. I restart the IDE, after index and analyze violation is gone and .editorconfig parse error balloon is shown. I remove the key with empty value from .editorconfig, violation does not come back. I fix the violation and reintroduce it, violation does not come back. I close and reopen the file, violation is shown again. I reintroduce the empty value in .editorconfig, violation stays. I fix the violation and reintroduce it, violation stays. I close the file and reopen it, volation stays.

paul-dingemans commented 6 months ago

I change .editorconfig to have an empty value for a key.

Example please.

Also I need your current configuration ktlint-plugin.xml Isee .idea folder) and .editorconfig and the code sample that you used.