feat(tree-sitter): add +tree-sitter/doctor command

For a quick diagnosis of the state of tree-sitter support in the current
buffer.
This commit is contained in:
Henrik Lissner
2025-09-16 16:57:27 -04:00
parent 5614faca7a
commit 4a6f9f741d
2 changed files with 12 additions and 1 deletions

View File

@@ -69,6 +69,14 @@ pre-Emacs 31."
(let (auto-mode-alist interpreter-mode-alist)
(apply fn args)))
;;; TODO: Backwards compatibility
;;;###autoload
(defun +tree-sitter/doctor ()
"Test if the current buffer is correctly tree-sitter-enabled."
(interactive)
(unless (treesit-available-p)
(user-error "This Emacs install wasn't built with treesit support!"))
(unless (treesit-parser-list)
(user-error "No tree-sitter parsers are active in this buffer; are the grammars properly installed?"))
(message "Tree-sitter is functioning in this buffer!"))
;;; tree-sitter.el ends here