mirror of
https://github.com/doomemacs/doomemacs.git
synced 2025-12-06 02:30:33 -08: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:
parent
75c3df7e87
commit
bbed615f17
1 changed files with 14 additions and 4 deletions
|
|
@ -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)
|
||||
(cdr ts))))
|
||||
;; 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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue