Skip to content

Commit

Permalink
fix: Split syntax check
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Mar 11, 2024
1 parent 595fcc7 commit 21b7c5f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sideline-flycheck.el
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ Argument COMMAND is required in sideline backend."
(unless (ht-contains-p sideline-flycheck--errors msg)
(ht-set sideline-flycheck--errors msg nil) ; doesn't care about value
(push msg msgs))))
(sideline-delete-ovs 'sideline-flycheck)
(funcall sideline-flycheck--callback msgs)
;; XXX: We need to set it to `nil', or else it will render multiple times.
(setq sideline-flycheck--callback nil))))
Expand All @@ -129,6 +128,11 @@ Argument COMMAND is required in sideline backend."
(run-at-time flycheck-display-errors-delay nil
#'sideline-flycheck--show (current-buffer))))

(defun sideline-flycheck--after-check ()
"Run after syntax check."
(sideline-delete-ovs 'sideline-flycheck)
(sideline-flycheck--show))

(defun sideline-flycheck--reset ()
"After sideline is reset."
(ht-clear sideline-flycheck--errors))
Expand All @@ -138,11 +142,11 @@ Argument COMMAND is required in sideline backend."
"Setup for `flycheck-mode'."
(cond
(flycheck-mode
(add-hook 'flycheck-after-syntax-check-hook #'sideline-flycheck--show nil t)
(add-hook 'flycheck-after-syntax-check-hook #'sideline-flycheck--after-check nil t)
(add-hook 'post-command-hook #'sideline-flycheck--post-command nil t)
(add-hook 'sideline-reset-hook #'sideline-flycheck--reset nil t))
(t
(remove-hook 'flycheck-after-syntax-check-hook #'sideline-flycheck--show t)
(remove-hook 'flycheck-after-syntax-check-hook #'sideline-flycheck--after-check t)
(remove-hook 'post-command-hook #'sideline-flycheck--post-command t)
(remove-hook 'sideline-reset-hook #'sideline-flycheck--reset t)
(sideline-render)))) ; update sideline once
Expand Down

0 comments on commit 21b7c5f

Please sign in to comment.