tweak(syntax): hide posframe on next user input

Close: #7813
Ref: #6416
Co-authored-by: Dev380 <Dev380@users.noreply.github.com>
This commit is contained in:
Henrik Lissner 2024-06-30 15:35:16 -04:00
parent 3cb9f17132
commit a189c211bf
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
2 changed files with 18 additions and 0 deletions

View file

@ -25,6 +25,9 @@ This module provides syntax checking and error highlighting, powered by
** Hacks ** Hacks
- If ~lsp-ui-mode~ is active, most of the aesthetic functionality of this module - If ~lsp-ui-mode~ is active, most of the aesthetic functionality of this module
is turned off, as they show the same information. is turned off, as they show the same information.
- If childframes are enabled, and the flycheck childframe is shown, it will be
hidden on the next user input (as well as the default behavior: to hide it the
next time the user is idle for ~flycheck-display-errors-delay~ seconds).
** TODO Changelog ** TODO Changelog
# This section will be machine generated. Don't edit it by hand. # This section will be machine generated. Don't edit it by hand.

View file

@ -74,6 +74,21 @@
(setq flycheck-posframe-warning-prefix "! " (setq flycheck-posframe-warning-prefix "! "
flycheck-posframe-info-prefix "··· " flycheck-posframe-info-prefix "··· "
flycheck-posframe-error-prefix "X ") flycheck-posframe-error-prefix "X ")
;; HACK: Hide the flycheck posframe immediately on the next keypress/user
;; action, otherwise it lingers until the next time the user is idle.
(defun +syntax--flycheck-posframe-hide-h ()
(unless (flycheck-posframe-check-position)
(posframe-hide flycheck-posframe-buffer))
(remove-hook 'post-command-hook #'+syntax--flycheck-posframe-hide-h))
(defadvice! +syntax-hide-posframe-on-next-command-a (fn &rest args)
:around #'flycheck-posframe-show-posframe
(letf! ((defun posframe-show (&rest args)
(add-hook 'post-command-hook #'+syntax--flycheck-posframe-hide-h)
(apply posframe-show args)))
(apply fn args)))
(after! company (after! company
;; Don't display popups if company is open ;; Don't display popups if company is open
(add-hook 'flycheck-posframe-inhibit-functions #'company--active-p)) (add-hook 'flycheck-posframe-inhibit-functions #'company--active-p))