Skip to content

Commit

Permalink
Removing "format" action from non-autocorrectable rules
Browse files Browse the repository at this point in the history
Per some discussion in #8
  • Loading branch information
nbadal committed Oct 20, 2020
1 parent 7b93f7c commit 7ccdb3f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Add post-format linter, with ability to disable via setting

### Changed
- Format action no longer appears for non-autocorrectable rules, since it doesn't address them.

### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/nbadal/ktlint/KtlintAnnotator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class KtlintAnnotator : ExternalAnnotator<PsiFile, List<LintError>>() {
val severity = if (config.treatAsErrors) HighlightSeverity.ERROR else HighlightSeverity.WARNING

holder.createAnnotation(severity, errorRange, message).apply {
registerFix(KtlintFormatAction())
if (it.canBeAutoCorrected) registerFix(KtlintFormatAction())
registerFix(KtlintGlobalDisableRuleAction(it.ruleId))
registerFix(KtlintDisableAction())
}
Expand Down

0 comments on commit 7ccdb3f

Please # to comment.