treesit-auto icon indicating copy to clipboard operation
treesit-auto copied to clipboard

treesit-auto-install-all command failed

Open getong opened this issue 1 year ago • 4 comments

The error msg:

The following tree-sitter grammars are/were missing:
janet
latex
markdown

getong avatar Sep 22 '24 03:09 getong

+1 Same issue here

yzhou216 avatar Sep 22 '24 04:09 yzhou216

This has not been fixed yet.

wang1zhen avatar Sep 18 '25 17:09 wang1zhen

This has not been fixed yet.

I'm not sure if this is still being maintained TBH. Does anyone know if there's a popular fork of this?

yzhou216 avatar Sep 25 '25 05:09 yzhou216

(setq treesit-language-source-alist
      '((bash        "https://github.com/tree-sitter/tree-sitter-bash"       nil      "src")
        (c           "https://github.com/tree-sitter/tree-sitter-c"          nil      "src")
        (cpp         "https://github.com/tree-sitter/tree-sitter-cpp"        nil      "src")
        (css         "https://github.com/tree-sitter/tree-sitter-css"        nil      "src")
        (go          "https://github.com/tree-sitter/tree-sitter-go"         nil      "src")
        (html        "https://github.com/tree-sitter/tree-sitter-html"       nil      "src")
        (java        "https://github.com/tree-sitter/tree-sitter-java"       nil      "src")
        (javascript  "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")
        (typescript  "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
        (tsx         "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")
        (json        "https://github.com/tree-sitter/tree-sitter-json"       nil      "src")
        (python      "https://github.com/tree-sitter/tree-sitter-python"     nil      "src")
        (rust        "https://github.com/tree-sitter/tree-sitter-rust"       nil      "src")
        (toml        "https://github.com/tree-sitter/tree-sitter-toml"       nil      "src")
        (yaml        "https://github.com/ikatyang/tree-sitter-yaml"          nil      "src")
        ))

(defun solarion/treesit-ensure (&rest langs)
  "install missing treesit grammar"
  (dolist (lang langs)
    (unless (treesit-language-available-p lang)
      (treesit-install-language-grammar lang))))

;; run at first installation
;; (solarion/treesit-ensure 'bash 'c 'cpp 'css 'go 'html 'java
;;                          'javascript 'typescript 'tsx 'json
;;                          'python 'rust 'toml 'yaml)

(setq major-mode-remap-alist
      '((c-mode          . c-ts-mode)
        (c++-mode        . c++-ts-mode)
        (c-or-c++-mode   . c-or-c++-ts-mode)
        (conf-toml-mode  . toml-ts-mode)
        (css-mode        . css-ts-mode)
        (js-mode         . js-ts-mode)
        (javascript-mode . js-ts-mode)
        (js-json-mode    . json-ts-mode)
        (json-mode       . json-ts-mode)
        (python-mode     . python-ts-mode)
        (sh-mode         . bash-ts-mode)
        (typescript-mode . typescript-ts-mode)
        (yaml-mode       . yaml-ts-mode)
        ))

Here is my workaround, FYI

wang1zhen avatar Sep 25 '25 12:09 wang1zhen