-
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
Add support for formatting a specific violation in a piece of code containing multiple violations #2658
Milestone
Comments
8 tasks
paul-dingemans
added a commit
that referenced
this issue
May 28, 2024
paul-dingemans
added a commit
that referenced
this issue
May 28, 2024
paul-dingemans
added a commit
that referenced
this issue
May 28, 2024
… the legacy format Closes #2658
paul-dingemans
added a commit
that referenced
this issue
May 28, 2024
paul-dingemans
added a commit
that referenced
this issue
May 28, 2024
paul-dingemans
added a commit
that referenced
this issue
May 28, 2024
paul-dingemans
added a commit
that referenced
this issue
May 28, 2024
paul-dingemans
added a commit
that referenced
this issue
May 28, 2024
…or not (#2671) When formatting code, the API Consumer should be able to decide whether a `LintError` has to be autocorrected, or not. In most cases the API Consumer wants to autocorrect all errors that have an autocorrect fix when formatting the code. The `ktlint-intellij-plugin` has two use cases in which not all `LintError` having an autocorrect should be fixed when invoking the `format` functionality. * In `manual` mode the plugin shows all `LintError`s. Users want to be able to choose to autocorrect a specific `LintError`, while at the same time ignoring other `LintErrors`. * When selecting a block of code in a file, the user want to be able to format only the `LintError`s in the selected text. To avoid breaking changes in Ktlint 1.x, a new `RuleAutocorrectApproveHandler` interface is added. This interfaces defines the new signatures for functions `beforeVisitChildNodes` and `afterVisitChildNodes`. Rules that implement this interface will request the API Consumer to approve to autocorrect a `LintError` before continuing with formatting the code. Closes #2658
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Ktlint formatting fixes all violations in a given piece of code for which an autocorrect is available. Given a piece of code that contains multiple violations that can be autocorrected, it is not easily possible to indicate that only one specific violations needs to be fixed.
When the
ktlint-intellij-plugin
is used inmanual
the user wants/needs to resolve the violations one by one in order to pick and choose which violations have to be corrected. See nbadal/ktlint-intellij-plugin#482The text was updated successfully, but these errors were encountered: