chore(emacs): setup flycheck next checkers for lsp-mode
When using lsp-mode with flycheck it hijacks all of the checkers that have been defined for all of the languages. When added other checkers they never get used because they are all overridden by lsp-mode. This adds a function so we can define checkers per mode then we can have lsp and another checker that is specific for the language
This commit is contained in:
parent
99dd45aa08
commit
cb1ecc7478
1 changed files with 12 additions and 0 deletions
|
|
@ -94,6 +94,18 @@
|
||||||
(setq flycheck-phpcs-standard "PSR2")
|
(setq flycheck-phpcs-standard "PSR2")
|
||||||
(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc)))
|
(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc)))
|
||||||
|
|
||||||
|
;; Define local checkers so we can add next checkers per mode. LSP mode takes
|
||||||
|
;; priority and we can define the next checker in the mode hooks. Each language
|
||||||
|
;; will define there checkers if needed.
|
||||||
|
;;
|
||||||
|
;; Example usage for adding the php checker for php-mode
|
||||||
|
;; (setq flycheck-local-checkers '((lsp . ((next-checkers . (php))))))
|
||||||
|
(defvar-local flycheck-local-checkers nil)
|
||||||
|
(defun +flycheck-checker-get(fn checker property)
|
||||||
|
(or (alist-get property (alist-get checker flycheck-local-checkers))
|
||||||
|
(funcall fn checker property)))
|
||||||
|
(advice-add 'flycheck-checker-get :around '+flycheck-checker-get)
|
||||||
|
|
||||||
;; Set the default column width to 80. The default in emacs is 70 that is too small for me
|
;; Set the default column width to 80. The default in emacs is 70 that is too small for me
|
||||||
(setq-default fill-column 80)
|
(setq-default fill-column 80)
|
||||||
(setq-default display-fill-column-indicator-column 80)
|
(setq-default display-fill-column-indicator-column 80)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue