2019-02-22 00:20:29 -05:00
|
|
|
;;; tools/flycheck/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
2019-06-14 18:29:25 +02:00
|
|
|
(defvar +flycheck-lazy-idle-delay 3.0
|
|
|
|
"The delay before flycheck checks the buffer, after a check that produces no
|
|
|
|
errors.")
|
2019-02-22 00:20:29 -05:00
|
|
|
|
|
|
|
|
|
|
|
;;
|
2019-04-01 20:30:31 -04:00
|
|
|
;;; Packages
|
2017-02-13 05:51:36 -05:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! flycheck
|
2019-07-22 23:31:52 +02:00
|
|
|
:commands flycheck-list-errors flycheck-buffer
|
|
|
|
:after-call doom-switch-buffer-hook after-find-file
|
2017-02-13 05:51:36 -05:00
|
|
|
:config
|
2019-04-01 20:30:31 -04:00
|
|
|
;; new-line checks are a mote excessive; idle checks are more than enough
|
2019-07-22 23:31:52 +02:00
|
|
|
(delq! 'new-line flycheck-check-syntax-automatically)
|
|
|
|
|
2019-08-19 12:29:11 -04:00
|
|
|
(add-hook! 'doom-escape-hook :append
|
2019-07-22 23:31:52 +02:00
|
|
|
(defun +flycheck-buffer-h ()
|
|
|
|
"Flycheck buffer on ESC in normal mode."
|
|
|
|
(when flycheck-mode
|
|
|
|
(ignore-errors (flycheck-buffer))
|
2019-08-19 12:29:11 -04:00
|
|
|
nil)))
|
2019-07-22 23:31:52 +02:00
|
|
|
|
2019-07-28 14:52:59 +02:00
|
|
|
(add-hook! 'flycheck-after-syntax-check-hook
|
2019-07-22 23:31:52 +02:00
|
|
|
(defun +flycheck-adjust-syntax-check-eagerness-h ()
|
|
|
|
"Check for errors less often when there aren't any.
|
2019-04-01 20:30:31 -04:00
|
|
|
Done to reduce the load flycheck imposes on the current buffer."
|
2019-07-22 23:31:52 +02:00
|
|
|
(if flycheck-current-errors
|
|
|
|
(kill-local-variable 'flycheck-idle-change-delay)
|
|
|
|
(setq-local flycheck-idle-change-delay +flycheck-lazy-idle-delay))))
|
2018-06-21 15:54:36 +02:00
|
|
|
|
|
|
|
(global-flycheck-mode +1))
|
2017-02-13 05:51:36 -05:00
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! flycheck-popup-tip
|
2019-07-22 23:31:52 +02:00
|
|
|
:commands flycheck-popup-tip-show-popup flycheck-popup-tip-delete-popup
|
|
|
|
:init (add-hook 'flycheck-mode-hook #'+flycheck-init-popups-h)
|
2019-04-01 20:30:31 -04:00
|
|
|
:config
|
|
|
|
(setq flycheck-popup-tip-error-prefix "✕ ")
|
|
|
|
(after! evil
|
|
|
|
;; Don't display errors while in insert mode, as it can affect the cursor's
|
|
|
|
;; position or cause disruptive input delays.
|
|
|
|
(add-hook 'flycheck-posframe-inhibit-functions #'evil-insert-state-p)))
|
2018-05-07 18:50:44 +02:00
|
|
|
|
2018-01-05 14:43:44 -05:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! flycheck-posframe
|
2019-07-22 23:31:52 +02:00
|
|
|
:when EMACS26+
|
|
|
|
:when (featurep! +childframe)
|
2019-03-01 14:25:18 -05:00
|
|
|
:defer t
|
2019-07-22 23:31:52 +02:00
|
|
|
:init (add-hook 'flycheck-mode-hook #'+flycheck-init-popups-h)
|
2018-05-09 11:26:06 +02:00
|
|
|
:config
|
|
|
|
(setq flycheck-posframe-warning-prefix "⚠ "
|
|
|
|
flycheck-posframe-info-prefix "··· "
|
|
|
|
flycheck-posframe-error-prefix "✕ "))
|