2015-04-11 02:23:16 +00:00
|
|
|
;;; packages.el --- Syntax Checking Layer packages File for Spacemacs
|
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2015-04-11 02:23:16 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2015-04-11 02:23:16 +00:00
|
|
|
|
2015-04-19 03:40:24 +00:00
|
|
|
(setq syntax-checking-packages
|
2018-11-20 19:55:37 +00:00
|
|
|
'(
|
|
|
|
flycheck
|
|
|
|
flycheck-pos-tip
|
|
|
|
popwin
|
|
|
|
))
|
2015-04-11 02:23:16 +00:00
|
|
|
|
|
|
|
(defun syntax-checking/init-flycheck ()
|
|
|
|
(use-package flycheck
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-04-11 02:23:16 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2018-06-11 06:07:23 +00:00
|
|
|
(spacemacs|add-transient-hook prog-mode-hook
|
|
|
|
(lambda () (when syntax-checking-enable-by-default
|
|
|
|
(global-flycheck-mode 1)))
|
|
|
|
lazy-load-flycheck)
|
2020-05-21 10:56:46 +00:00
|
|
|
(setq flycheck-standard-error-navigation syntax-checking-use-standard-error-navigation
|
2016-01-27 20:08:25 +00:00
|
|
|
flycheck-global-modes nil)
|
2018-06-11 06:07:23 +00:00
|
|
|
;; key bindings
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
"eb" 'flycheck-buffer
|
|
|
|
"ec" 'flycheck-clear
|
|
|
|
"eh" 'flycheck-describe-checker
|
|
|
|
"el" 'spacemacs/toggle-flycheck-error-list
|
|
|
|
"eL" 'spacemacs/goto-flycheck-error-list
|
|
|
|
"es" 'flycheck-select-checker
|
|
|
|
"eS" 'flycheck-set-checker-executable
|
|
|
|
"ev" 'flycheck-verify-setup
|
2017-03-22 09:00:59 +00:00
|
|
|
"ey" 'flycheck-copy-errors-as-kill
|
2018-06-11 06:07:23 +00:00
|
|
|
"ex" 'flycheck-explain-error-at-point)
|
2015-04-11 02:23:16 +00:00
|
|
|
(spacemacs|add-toggle syntax-checking
|
2016-05-31 13:11:00 +00:00
|
|
|
:mode flycheck-mode
|
2015-07-25 13:14:53 +00:00
|
|
|
:documentation "Enable error and syntax checking."
|
2018-06-11 06:07:23 +00:00
|
|
|
:evil-leader "ts"))
|
|
|
|
:config
|
|
|
|
(progn
|
2015-05-14 02:55:32 +00:00
|
|
|
(spacemacs|diminish flycheck-mode " ⓢ" " s")
|
2015-04-11 02:23:16 +00:00
|
|
|
;; Custom fringe indicator
|
2016-08-13 17:51:29 +00:00
|
|
|
(when (and (fboundp 'define-fringe-bitmap)
|
|
|
|
(not syntax-checking-use-original-bitmaps))
|
2015-04-11 02:23:16 +00:00
|
|
|
(define-fringe-bitmap 'my-flycheck-fringe-indicator
|
|
|
|
(vector #b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00011100
|
|
|
|
#b00111110
|
|
|
|
#b00111110
|
|
|
|
#b00111110
|
|
|
|
#b00011100
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
|
|
|
#b00000000
|
2015-10-28 13:13:37 +00:00
|
|
|
#b00000000)))
|
2016-08-13 17:51:29 +00:00
|
|
|
(let ((bitmap (if syntax-checking-use-original-bitmaps
|
|
|
|
'flycheck-fringe-bitmap-double-arrow
|
|
|
|
'my-flycheck-fringe-indicator)))
|
|
|
|
(flycheck-define-error-level 'error
|
|
|
|
:severity 2
|
|
|
|
:overlay-category 'flycheck-error-overlay
|
|
|
|
:fringe-bitmap bitmap
|
2018-01-14 23:13:35 +00:00
|
|
|
:error-list-face 'flycheck-error-list-error
|
2016-08-13 17:51:29 +00:00
|
|
|
:fringe-face 'flycheck-fringe-error)
|
|
|
|
(flycheck-define-error-level 'warning
|
|
|
|
:severity 1
|
|
|
|
:overlay-category 'flycheck-warning-overlay
|
|
|
|
:fringe-bitmap bitmap
|
2018-01-14 23:13:35 +00:00
|
|
|
:error-list-face 'flycheck-error-list-warning
|
2016-08-13 17:51:29 +00:00
|
|
|
:fringe-face 'flycheck-fringe-warning)
|
|
|
|
(flycheck-define-error-level 'info
|
|
|
|
:severity 0
|
|
|
|
:overlay-category 'flycheck-info-overlay
|
|
|
|
:fringe-bitmap bitmap
|
2018-01-14 23:13:35 +00:00
|
|
|
:error-list-face 'flycheck-error-list-info
|
2016-08-13 17:51:29 +00:00
|
|
|
:fringe-face 'flycheck-fringe-info))
|
2015-04-11 02:23:16 +00:00
|
|
|
|
2015-11-21 10:07:14 +00:00
|
|
|
(evilified-state-evilify-map flycheck-error-list-mode-map
|
|
|
|
:mode flycheck-error-list-mode
|
|
|
|
:bindings
|
|
|
|
"RET" 'flycheck-error-list-goto-error
|
|
|
|
"j" 'flycheck-error-list-next-error
|
2018-06-11 06:07:23 +00:00
|
|
|
"k" 'flycheck-error-list-previous-error))))
|
2015-04-11 02:23:16 +00:00
|
|
|
|
|
|
|
(defun syntax-checking/init-flycheck-pos-tip ()
|
|
|
|
(use-package flycheck-pos-tip
|
2015-04-28 03:37:26 +00:00
|
|
|
:if syntax-checking-enable-tooltips
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-04-11 02:23:16 +00:00
|
|
|
:init
|
2015-11-13 10:21:31 +00:00
|
|
|
(with-eval-after-load 'flycheck
|
2020-07-30 14:59:00 +00:00
|
|
|
(flycheck-pos-tip-mode)
|
|
|
|
(setq flycheck-pos-tip-timeout (or syntax-checking-auto-hide-tooltips 0)))))
|
2015-04-11 02:23:16 +00:00
|
|
|
|
2020-07-03 19:44:51 +00:00
|
|
|
(defun syntax-checking/pre-init-popwin ()
|
|
|
|
(spacemacs|use-package-add-hook popwin
|
|
|
|
:post-config
|
|
|
|
(push '("^\\*Flycheck.+\\*$"
|
|
|
|
:regexp t
|
|
|
|
:dedicated t
|
|
|
|
:position bottom
|
|
|
|
:stick t
|
|
|
|
:noselect t)
|
|
|
|
popwin:special-display-config)))
|