Skip to content

Commit

Permalink
fix: Prevent sideline being deleted in after check
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Mar 11, 2024
1 parent 21b7c5f commit 8ac6b58
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions sideline-flycheck.el
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,24 @@ Argument COMMAND is required in sideline backend."
(add-face-text-property 0 (length msg) face nil msg)
(unless (ht-contains-p sideline-flycheck--errors msg)
(ht-set sideline-flycheck--errors msg nil) ; doesn't care about value
(message "render")
(push msg msgs))))
(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))))

(defun sideline-flycheck--post-command ()
"Display error message at point with a delay, unless already displayed."
(when (timerp sideline-flycheck--timer) (cancel-timer sideline-flycheck--timer))
(setq sideline-flycheck--timer
(run-at-time flycheck-display-errors-delay nil
#'sideline-flycheck--show (current-buffer))))
;; XXX: Run only when the errors exist!
;;
;; We need this to prevent overlays being deleted from the function
;; `sideline-flycheck--after-check'. Another way to interpret this, is to
;; check if flycheck is currently doing the syntax check.
(when (sideline-flycheck--get-errors)
(when (timerp sideline-flycheck--timer) (cancel-timer sideline-flycheck--timer))
(setq sideline-flycheck--timer
(run-at-time flycheck-display-errors-delay nil
#'sideline-flycheck--show (current-buffer)))))

(defun sideline-flycheck--after-check ()
"Run after syntax check."
Expand Down

0 comments on commit 8ac6b58

Please sign in to comment.