I’d like to try tree sitter for typescript/react development. I saw in this post that I should add the tree-sitter module in init.el and add flags to the lang modules I want, but when I try activating tsx-ts-mode I get the following error, depending on file:
Warning (treesit): Cannot activate tree-sitter, because language grammar for typescript is unavailable (not-found): (libtree-sitter-typescript.so libtree-sitter-typescript.so.0 libtree-sitter-typescript.so.0.0 libtree-sitter-typescript.dylib libtree-sitter-typescript.dylib.0 libtree-sitter-typescript.dylib.0.0) No such file or directory
Warning (treesit): Cannot activate tree-sitter, because language grammar for tsx is unavailable (not-found): (libtree-sitter-tsx.so libtree-sitter-tsx.so.0 libtree-sitter-tsx.so.0.0 libtree-sitter-tsx.dylib libtree-sitter-tsx.dylib.0 libtree-sitter-tsx.dylib.0.0) No such file or directory
When I try to activate tree-sitter-mode, I see `tree-sitter–setup: No language registered for major mode ‘tsx-ts-mode’. The file that I’m in has little to no syntax highlighting.
I ran tree-sitter-langs-install-grammars, and see tsx.dylib and typescript.dylib in .emacs.d/.local/straight/build-29.1/tree-sitter-langs/bin/.
What did you expect to happen?
I’m hoping to get syntax highlighting and general typescript/tsx support. I’ve been relying on typescript-tsx-mode for the last year or so and would love to leave it behind.
Side note: I’ve been using doom happily for about a year, but am still a beginner when it comes to understanding emacs internals. What’s the difference between typescript-tsx-mode vs ts-tsx-mode vs typescript-ts-mode? Should I be using one over the other? How does tree-sitter interact with everything?
Steps to reproduce
Uncomment tree-sitter in init.el
Add +tree-sitter to the web lang. (I now have: (web +lsp +tree-sitter))
I have the same problem but on a Linux with emacs 29.2.
Warning (treesit): Cannot activate tree-sitter, because language grammar for json is unavailable (not-found): (libtree-sitter-json libtree-sitter-json.0 libtree-sitter-json.0.0 libtree-sitter-json.so libtree-sitter-json.so.0 libtree-sitter-json.so.0.0) No such file or directory
Grammar files are present, but without libtree-sitter- prefix:
$ ls .local/straight/build-29.2/tree-sitter-langs/bin/jso*
.local/straight/build-29.2/tree-sitter-langs/bin/json.so
.local/straight/build-29.2/tree-sitter-langs/bin/jsonnet.so