renzmann / treesit-auto

Automatic installation, usage, and fallback for tree-sitter major modes in Emacs 29
GNU General Public License v3.0
353 stars 27 forks source link

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

Open lifeisfoo opened 2 months ago

lifeisfoo commented 2 months ago

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))
renzmann commented 2 months ago

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.