mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-04 15:03:42 -05:00
feat(tree-sitter): batch grammar installs
Instead of being prompted 2-4 times to install each missing grammar, batches them together into one prompt.
This commit is contained in:
@@ -70,10 +70,20 @@
|
|||||||
;; and push forward anyway, even if a missing grammar
|
;; and push forward anyway, even if a missing grammar
|
||||||
;; results in a broken state.
|
;; results in a broken state.
|
||||||
(not (fboundp fallback-mode))
|
(not (fboundp fallback-mode))
|
||||||
(cl-every (if (get mode '+tree-sitter-ensured)
|
;; Ensure grammars are present (and prompt to install
|
||||||
(doom-rpartial #'treesit-ready-p 'message)
|
;; them if needed).
|
||||||
#'treesit-ensure-installed)
|
(if-let* ((grammars
|
||||||
(cdr ts))))
|
(cl-remove-if (doom-rpartial #'treesit-ready-p 'message)
|
||||||
|
(cdr ts))))
|
||||||
|
(if (or (eq treesit-auto-install-grammar 'always)
|
||||||
|
(if (eq treesit-auto-install-grammar 'ask)
|
||||||
|
(y-or-n-p
|
||||||
|
(format "Missing tree-sitter grammars: %s\nInstall now?"
|
||||||
|
(mapconcat #'symbol-name grammars ", ")))))
|
||||||
|
(mapc #'treesit-install-language-grammar grammars)
|
||||||
|
(message "Aborted installing missing grammars...")
|
||||||
|
nil)
|
||||||
|
t)))
|
||||||
(put mode '+tree-sitter-ensured t)
|
(put mode '+tree-sitter-ensured t)
|
||||||
mode)
|
mode)
|
||||||
(fallback-mode))
|
(fallback-mode))
|
||||||
|
Reference in New Issue
Block a user