parent
812c834970
commit
b871d400e5
2 changed files with 13 additions and 30 deletions
|
@ -1,24 +1,13 @@
|
||||||
;;; tools/flycheck/autoload.el -*- lexical-binding: t; -*-
|
;;; tools/flycheck/autoload.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +flycheck*popup-tip-delete-popup (orig-fn)
|
(defun +flycheck|init-popups ()
|
||||||
"TODO"
|
"Activate `flycheck-posframe-mode' if available and in GUI Emacs.
|
||||||
(when (display-graphic-p)
|
Activate `flycheck-popup-tip-mode' otherwise.
|
||||||
(funcall orig-fn)))
|
Do nothing if `lsp-ui-mode' is active and `lsp-ui-sideline-enable' is non-nil."
|
||||||
|
(unless (and (bound-and-true-p lsp-ui-mode)
|
||||||
;;;###autoload
|
|
||||||
(defun +flycheck*popup-tip-show-popup (orig-fn errors)
|
|
||||||
"TODO"
|
|
||||||
(if (and EMACS26+
|
|
||||||
(featurep 'flycheck-posframe)
|
|
||||||
(display-graphic-p))
|
|
||||||
(flycheck-posframe-show-posframe errors)
|
|
||||||
(funcall orig-fn errors)))
|
|
||||||
|
|
||||||
;;;###autoload
|
|
||||||
(defun +flycheck|disable-popup-tip-for-lsp ()
|
|
||||||
"Disable `+flycheck-popup-mode' if `lsp-ui-mode' and `lsp-ui-sideline-enable'
|
|
||||||
are non-nil."
|
|
||||||
(when (and (bound-and-true-p lsp-ui-mode)
|
|
||||||
lsp-ui-sideline-enable)
|
lsp-ui-sideline-enable)
|
||||||
(flycheck-popup-tip-mode -1)))
|
(if (and (fboundp 'flycheck-posframe-mode)
|
||||||
|
(display-graphic-p))
|
||||||
|
(flycheck-posframe-mode +1)
|
||||||
|
(flycheck-popup-tip-mode +1))))
|
||||||
|
|
|
@ -32,19 +32,13 @@
|
||||||
|
|
||||||
(def-package! flycheck-popup-tip
|
(def-package! flycheck-popup-tip
|
||||||
:commands (flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup)
|
:commands (flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup)
|
||||||
:hook (flycheck-mode . flycheck-popup-tip-mode)
|
:init (add-hook 'flycheck-mode-hook #'+flycheck|init-popups)
|
||||||
:init (add-hook 'lsp-ui-mode-hook #'+flycheck|disable-popup-tip-for-lsp)
|
:config (setq flycheck-popup-tip-error-prefix "✕ "))
|
||||||
:config
|
|
||||||
(setq flycheck-popup-tip-error-prefix "✕ ")
|
|
||||||
;; Allow `flycheck-posframe' or `flycheck-popup-tip' to co-exist
|
|
||||||
;; interchangibly, depending on the display device (terminal or GUI Emacs).
|
|
||||||
(advice-add #'flycheck-popup-tip-show-popup :around #'+flycheck*popup-tip-show-popup)
|
|
||||||
(advice-add #'flycheck-popup-tip-delete-popup :around #'+flycheck*popup-tip-delete-popup))
|
|
||||||
|
|
||||||
|
|
||||||
(def-package! flycheck-posframe
|
(def-package! flycheck-posframe
|
||||||
:when (and EMACS26+ (featurep! +childframe))
|
:when (and EMACS26+ (featurep! +childframe))
|
||||||
:commands flycheck-posframe-show-posframe
|
:init (add-hook 'flycheck-mode-hook #'+flycheck|init-popups)
|
||||||
:config
|
:config
|
||||||
(setq flycheck-posframe-warning-prefix "⚠ "
|
(setq flycheck-posframe-warning-prefix "⚠ "
|
||||||
flycheck-posframe-info-prefix "··· "
|
flycheck-posframe-info-prefix "··· "
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue