mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-22 08:04:20 +01:00
640de3fb86
This reverts commit b673fb12c1
.
1.9 KiB
1.9 KiB
Flycheck
#
Flycheck Posframe
Display flycheck messages in a posframe.
(use-package flycheck-posframe
:straight t
:config
(setq flycheck-posframe-position 'frame-bottom-right-corner)
<<flycheck-display-errors-delay>>
<<lsp-ui-sideline-show-diagnostics>>
:hook (flycheck-mode . flycheck-posframe-mode))
Flycheck calls flycheck-display-errors-function
every flycheck-display-errors-delay
.
(setq flycheck-display-errors-delay 0.1)
Since we get errors and such in a posframe, we don't need them in the sideline.
(setq lsp-ui-sideline-show-diagnostics nil)
Since flycheck recalls flycheck-display-errors-function
on every point movement, it creates this really ugly flicker and also lags a bit, so if the diagnostic message didn't change, filter out the call.
(defvar flycheck-posframe-last-error-list '())
(advice-add
'flycheck-posframe-hidehandler
:override
(lambda (info)
(if (not (equal
(flycheck-overlay-errors-at (point))
flycheck-posframe-last-error-list))
(progn
(setq flycheck-posframe-last-error-list nil)
t)
nil))
'((name . "flycheck-error-display-filter")))
(advice-add
'flycheck-posframe-show-posframe
:before-while
(lambda (diagnostic)
(let ((last-list flycheck-posframe-last-error-list))
(setq flycheck-posframe-last-error-list diagnostic)
(if (equal diagnostic last-list) nil t)))
'((name . "flycheck-error-display-filter")))