Skip to content

Commit 082640d

Browse files
committed
Add function to install treesit grammars.
1 parent d28936a commit 082640d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lisp/languages/init-treesit.el

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
'((bash "https://github.com/tree-sitter/tree-sitter-bash")
99
(cmake "https://github.com/uyha/tree-sitter-cmake")
1010
(css "https://github.com/tree-sitter/tree-sitter-css")
11+
(dockerfile "https://github.com/camdencheek/tree-sitter-dockerfile" "main" "src")
1112
(elisp "https://github.com/Wilfred/tree-sitter-elisp")
1213
(go "https://github.com/tree-sitter/tree-sitter-go")
1314
(html "https://github.com/tree-sitter/tree-sitter-html")
@@ -22,6 +23,21 @@
2223
(yaml "https://github.com/ikatyang/tree-sitter-yaml")))
2324

2425

26+
(defvar rb-treesit-grammars-enabled
27+
'(bash dockerfile javascript json python tsx typescript yaml)
28+
"Language ids pointing to `treesit-language-source-alist` for which treesit grammar is enabled."
29+
)
30+
31+
(defun rb/install-treesit-grammars ()
32+
"Install all enabled treesit grammars."
33+
(interactive)
34+
(dolist (grammar rb-treesit-grammars-enabled)
35+
(message "Installing treesit grammar for %s ..." grammar)
36+
(treesit-install-language-grammar grammar))
37+
)
38+
39+
40+
2541
(provide 'init-treesit)
2642

2743
;;; init-treesit.el ends here

0 commit comments

Comments
 (0)