2020-01-09 18:41:48 -05:00
|
|
|
;;; checkers/syntax/config.el -*- lexical-binding: t; -*-
|
2019-02-22 00:20:29 -05:00
|
|
|
|
|
|
|
;;
|
2020-01-09 18:41:48 -05:00
|
|
|
;;; Flycheck
|
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-10-19 17:01:10 -04:00
|
|
|
(setq flycheck-emacs-lisp-load-path 'inherit)
|
|
|
|
|
|
|
|
;; Check only when saving or opening files. Newline & idle checks are a mote
|
2020-03-27 01:25:30 -04:00
|
|
|
;; excessive and can catch code in an incomplete state, producing false
|
|
|
|
;; positives, so we removed them.
|
2019-10-19 17:01:10 -04:00
|
|
|
(setq flycheck-check-syntax-automatically '(save mode-enabled))
|
2019-07-22 23:31:52 +02:00
|
|
|
|
2019-10-20 19:57:46 -04:00
|
|
|
;; Display errors a little quicker (default is 0.9s)
|
|
|
|
(setq flycheck-display-errors-delay 0.25)
|
|
|
|
|
2019-10-25 01:26:56 -04:00
|
|
|
;; Don't commandeer input focus if the error message pops up (happens when
|
|
|
|
;; tooltips and childframes are disabled).
|
2019-12-03 20:42:39 -05:00
|
|
|
(set-popup-rule! "^\\*Flycheck error messages\\*" :select nil)
|
2019-10-25 01:26:56 -04:00
|
|
|
|
2019-08-19 12:29:11 -04:00
|
|
|
(add-hook! 'doom-escape-hook :append
|
2020-01-09 18:41:48 -05:00
|
|
|
(defun +syntax-check-buffer-h ()
|
2019-07-22 23:31:52 +02:00
|
|
|
"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-10-26 21:34:44 -04:00
|
|
|
(map! :map flycheck-error-list-mode-map
|
|
|
|
:n "C-n" #'flycheck-error-list-next-error
|
|
|
|
:n "C-p" #'flycheck-error-list-previous-error
|
|
|
|
:n "j" #'flycheck-error-list-next-error
|
|
|
|
:n "k" #'flycheck-error-list-previous-error
|
|
|
|
:n "RET" #'flycheck-error-list-goto-error
|
|
|
|
:n [return] #'flycheck-error-list-goto-error)
|
|
|
|
|
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
|
2020-03-27 01:25:30 -04:00
|
|
|
:hook (flycheck-mode . +syntax-init-popups-h)
|
2019-04-01 20:30:31 -04:00
|
|
|
:config
|
|
|
|
(setq flycheck-popup-tip-error-prefix "✕ ")
|
|
|
|
(after! evil
|
2019-10-05 12:47:31 -04:00
|
|
|
;; Don't display popups while in insert or replace mode, as it can affect
|
|
|
|
;; the cursor's position or cause disruptive input delays.
|
|
|
|
(add-hook! '(evil-insert-state-entry-hook evil-replace-state-entry-hook)
|
|
|
|
#'flycheck-popup-tip-delete-popup)
|
2020-01-09 18:41:48 -05:00
|
|
|
(defadvice! +syntax--disable-flycheck-popup-tip-maybe-a (&rest _)
|
2019-10-05 12:47:31 -04:00
|
|
|
:before-while #'flycheck-popup-tip-show-popup
|
2019-10-19 17:01:31 -04:00
|
|
|
(if evil-local-mode
|
|
|
|
(eq evil-state 'normal)
|
|
|
|
(not (bound-and-true-p company-backend))))))
|
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 (featurep! +childframe)
|
2020-03-27 01:25:30 -04:00
|
|
|
:hook (flycheck-mode . +syntax-init-popups-h)
|
2018-05-09 11:26:06 +02:00
|
|
|
:config
|
|
|
|
(setq flycheck-posframe-warning-prefix "⚠ "
|
|
|
|
flycheck-posframe-info-prefix "··· "
|
2019-10-05 12:47:31 -04:00
|
|
|
flycheck-posframe-error-prefix "✕ ")
|
2019-10-19 17:01:31 -04:00
|
|
|
(after! company
|
|
|
|
;; Don't display popups if company is open
|
|
|
|
(add-hook 'flycheck-posframe-inhibit-functions #'company--active-p))
|
2019-10-05 12:47:31 -04:00
|
|
|
(after! evil
|
|
|
|
;; Don't display popups while in insert or replace mode, as it can affect
|
|
|
|
;; the cursor's position or cause disruptive input delays.
|
|
|
|
(add-hook! 'flycheck-posframe-inhibit-functions
|
|
|
|
#'evil-insert-state-p
|
|
|
|
#'evil-replace-state-p)))
|
2020-01-09 18:41:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;; TODO Flymake
|