dockerfile and terraform syntax checking
This commit is contained in:
22
.spacemacs
22
.spacemacs
@@ -80,8 +80,8 @@ This function should only modify configuration layer settings."
|
|||||||
syntax-checking
|
syntax-checking
|
||||||
;; version-control
|
;; version-control
|
||||||
treemacs
|
treemacs
|
||||||
docker
|
(docker :variables docker-dockerfile-backend 'lsp)
|
||||||
terraform
|
(terraform :variables terraform-backend 'lsp)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -799,6 +799,24 @@ before packages are loaded."
|
|||||||
;; otherwise it locks up emacs startup
|
;; otherwise it locks up emacs startup
|
||||||
(add-hook 'sh-mode-hook #'lsp-deferred)
|
(add-hook 'sh-mode-hook #'lsp-deferred)
|
||||||
|
|
||||||
|
;; Chain mode-specific checkers (Hadolint, TFLint) to run after LSP.
|
||||||
|
;; We use `lsp-managed-mode-hook` to ensure the `lsp` checker is fully
|
||||||
|
;; defined before modifying its chain, preventing "lsp is not a valid
|
||||||
|
;; syntax checker" errors during startup.
|
||||||
|
(defun jp/lsp-flycheck-chaining ()
|
||||||
|
"Chain specific checkers to LSP based on the current mode."
|
||||||
|
(cond
|
||||||
|
;; Dockerfile: LSP -> Hadolint
|
||||||
|
((derived-mode-p 'dockerfile-mode)
|
||||||
|
(flycheck-add-next-checker 'lsp 'dockerfile-hadolint))
|
||||||
|
|
||||||
|
;; Terraform: LSP -> TFLint
|
||||||
|
((derived-mode-p 'terraform-mode)
|
||||||
|
(flycheck-add-next-checker 'lsp 'terraform-tflint))))
|
||||||
|
|
||||||
|
;; Run this whenever LSP starts managing a buffer
|
||||||
|
(add-hook 'lsp-managed-mode-hook #'jp/lsp-flycheck-chaining)
|
||||||
|
|
||||||
;; / LSP config
|
;; / LSP config
|
||||||
|
|
||||||
;; jira config
|
;; jira config
|
||||||
|
|||||||
Reference in New Issue
Block a user