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

C++ mode requires another mode and its installation is not handled

Open lifeisfoo opened this issue 1 year ago • 1 comments

Opening a C++ file requires the C++ grammar to be installed but it seems that another grammar is also required in order to activate tree-sitter.

Even after an emacs restart, trying to open a C++ file throws this error:

Warning (treesit): Cannot activate tree-sitter, because language grammar for c is unavailable (not-found): (libtree-sitter-c libtree-sitter-c.0 libtree-sitter-c.0.0 libtree-sitter-c.so libtree-sitter-c.so.0 libtree-sitter-c.so.0.0) No such file or directory


Setup code:

 (use-package treesit-auto
   :ensure t
   :custom
   (treesit-auto-install 'prompt)
   :config
   (treesit-auto-add-to-auto-mode-alist 'all)
   (global-treesit-auto-mode))

lifeisfoo avatar May 13 '24 07:05 lifeisfoo

As it stands, I don't have the C++ grammar requiring C:

https://github.com/renzmann/treesit-auto/blob/016bd286a1ba4628f833a626f8b9d497882ecdf3/treesit-auto.el#L130-L135

Looks like we'll need to add :requires 'c to the cpp recipe.

renzmann avatar May 16 '24 23:05 renzmann