nbadal / ktlint-intellij-plugin

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

Support projects containing complex `.editorconfig` #371

Closed paul-dingemans closed 6 months ago

paul-dingemans commented 10 months ago

In case an .editorconfig contains multiple globs having specific configuration, on in case the project contains multiple .editorconfig files, the path to the file becomes important for loading the correct settings from the .editorconfig. By default this is supported by ktlint when using the Code.fromFile(..) helper on invocation of the lint(..) or format(..) functions. It can however not be guaranteed that all changes have changed to the physical file before those functions are invoked. In 0.20.0 (with ktlint 1.0.1 a workaround has been implemented.

With introduction of the new Code.fromSnippetWithPath(..) helper in ktlint 1.1.x (https://github.com/pinterest/ktlint/issues/2340) this workaround can be removed.

paul-dingemans commented 6 months ago

The helper function Code.fromSnippetWithPath(..) is already in use since version 0.20.1. The rule filename however is still disabled and should have be removed with using the helper function.