From 0bb354b89ddd86bb2fa7e912b31a132dcde74534 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Thu, 21 Nov 2024 01:32:52 +0000 Subject: [PATCH] chore(language/yaml): improve setup of yaml-ts-mode --- modules/languages/siren-yaml.el | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/modules/languages/siren-yaml.el b/modules/languages/siren-yaml.el index 7d3959a..c228c1b 100644 --- a/modules/languages/siren-yaml.el +++ b/modules/languages/siren-yaml.el @@ -86,11 +86,26 @@ or *.yaml file in a .github/workflows/ directory." :config (siren-flycheck-setup-yaml-actionlint)) +(when (fboundp 'yaml-ts-mode) + (use-package yaml-ts-mode + :straight (:type built-in) + :hook (yaml-ts-mode . siren-yaml-ts-mode-setup) + + :preface + (defun siren-yaml-ts-mode-setup () + (run-hooks 'prog-mode-hook) + (setq-local tab-width 2)) + + :config + (siren-treesit-auto-ensure-grammar 'yaml) + (siren-flycheck-setup-yaml-actionlint))) + (use-package lsp-yaml :straight lsp-mode :hook (yaml-mode . siren-lsp-yaml-mode-setup) + (yaml-ts-mode . siren-lsp-yaml-mode-setup) :preface (defun siren-lsp-yaml-mode-setup () @@ -107,15 +122,5 @@ or *.yaml file in a .github/workflows/ directory." :config (yaml-imenu-enable)) -(use-package yaml-ts-mode - :straight (:type built-in) - :after yaml-mode - :if (fboundp 'yaml-ts-mode) - :hook (yaml-ts-mode . siren-yaml-ts-mode-setup) - - :preface - (defun siren-yaml-ts-mode-setup () - (run-hooks 'yaml-mode-hook))) - (provide 'siren-yaml) ;;; siren-yaml.el ends here