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
|
||||
;; results in a broken state.
|
||||
(not (fboundp fallback-mode))
|
||||
(cl-every (if (get mode '+tree-sitter-ensured)
|
||||
(doom-rpartial #'treesit-ready-p 'message)
|
||||
#'treesit-ensure-installed)
|
||||
;; Ensure grammars are present (and prompt to install
|
||||
;; them if needed).
|
||||
(if-let* ((grammars
|
||||
(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)
|
||||
mode)
|
||||
(fallback-mode))
|
||||
|
Reference in New Issue
Block a user