How to *update* language libs?
Treesit-auto-install-all will find any languages not yet installed, but I don't think it tracks versions so it can't update languages if their upstream code has been improved. It would be nice to be able to update.
To be honest, I don't think automatic version update is a desired behavior for most people. Since the base Tree-Sitter API is not versioned, new types of nodes might be added and Emacs treesit will scream and self-destruct. ~~(cough typescript cough)~~
Maybe addressing #99 can partially solve this problem? When you need a new version, simply navigate to user-emacs-directory and delete the .so file you want to update, then new grammar definition should be one treesit-auto-install-all away.
This helps when I want to update all grammars by treesit-auto:
(defun my/update-treesit-auto-grammars ()
"Update tree sitter grammars defined by `treesit-auto'."
(interactive)
(let* ((files (directory-files (locate-user-emacs-file "tree-sitter") nil directory-files-no-dot-files-regexp))
(langs (mapcar
(lambda (file)
(and (string-match
(format "libtree-sitter-\\(.+\\)%s" (car dynamic-library-suffixes))
file)
(intern (match-string 1 file))))
files))
(treesit-language-source-alist (treesit-auto--build-treesit-source-alist)))
(cl-loop for lang in langs do
(if (assoc lang treesit-language-source-alist)
(progn
(message "Installing language grammar for: %s" lang)
(treesit-install-language-grammar lang))
(message "Skipping grammar for %s" lang)))))