Add my/treesit-compile-all

This commit is contained in:
Alexander Rosenberg 2024-04-20 13:48:30 -07:00
parent dc437388e7
commit 2e05ad6eb7
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

16
init.el
View File

@ -128,7 +128,7 @@
(css "https://github.com/tree-sitter/tree-sitter-css")
(go "https://github.com/tree-sitter/tree-sitter-go")
(gomod "https://github.com/camdencheek/tree-sitter-go-mod")
(js "https://github.com/tree-sitter/tree-sitter-javascript")
(javascript "https://github.com/tree-sitter/tree-sitter-javascript")
(bash "https://github.com/tree-sitter/tree-sitter-bash")
(cmake "https://github.com/uyha/tree-sitter-cmake")
(blueprint "https://github.com/huanie/tree-sitter-blueprint")))
@ -144,7 +144,19 @@
(yaml-mode . yaml-ts-mode)
(css-mode . css-ts-mode)
(js-mode . js-ts-mode)
(cmake-mode . cmake-ts-mode))))
(cmake-mode . cmake-ts-mode)))
(defun my/treesit-compile-all (force)
"Compile all the modules defined in `treesit-language-source-alist'.
If FORCE, recompile all modules, even ones that are already compiled.
Interactively, force the recompile if called with a prefix."
(interactive "P")
(let ((did-build nil))
(dolist (lang treesit-language-source-alist)
(when (or force (not (treesit-language-available-p (car lang))))
(treesit-install-language-grammar (car lang))
(setq did-build t)))
(unless did-build
(message "All defined parsers installed!")))))
(use-package tab-bar
:ensure nil