JonathanHope / mermaid-ts-mode

Emacs Major Mode for Mermaid Using Tree Sitter
GNU General Public License v3.0
21 stars 4 forks source link

Clarify instructions for installing tree-sitter grammar? #4

Open timcharper opened 7 months ago

timcharper commented 7 months ago

I'm not a tree-sitter pro by any means. I've noticed that grammar is in version "0.12.86" of tree-sitter-langs, however, when I tried to load it, even though (tree-sitter-require 'mermaid) returned t, (treesit-ready-p 'mermaid) still returned nil.

However, what did work was this:

(customize and set variable tree-sitter-langs-git-dir to ~/.emacs.d/tree-sitter/grammars/)

  (setq treesit-language-source-alist
   '((mermaid "https://github.com/monaqa/tree-sitter-mermaid")))

M-x treesit-install-language-grammar "mermaid"

Then, (treesit-ready-p 'mermaid) returned true.

I'm not entirely sure why the version in tree-sitter-langs was insufficient, but I thought this would be at least an interesting thing to raise, and perhaps a good note for the README?

kiennq commented 3 months ago

tree-sitter-langs and the built-in treesit are different thing. For the built-in tree-sit to work with binaries from tree-sitter-langs, you will need to add that path to treesit-extra-load-path. Also, the tree-sitter parsers have to be named in the format of libtree-sitter-<lang>.<ext>