renzmann / treesit-auto

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

Major modes not switching after grammar is installed for the very first time #48

Closed sethen closed 9 months ago

sethen commented 1 year ago

Here's my current setup

(use-package treesit-auto
  :config
  (setq treesit-auto-install t)
  (global-treesit-auto-mode))

Whenever I visit a buffer for a grammar I do not have treesit-auto does the right thing and installs it. However it still keeps the major mode of, for example, go-mode instead of go-ts-mode. If I set a hook just for go-ts-mode and install the grammar the file loads as go-mode and it does not pick up my hook. It seems to me that once the grammar is installed for the very first time the major mode should switch automatically when the buffer loads. If I describe the variable after that grammar installation I am still getting the non-ts mode for whatever reason. At that point I have to restart emacs to see the correct major mode.

Because of this I have to set hooks for both modes. This is not ideal.

renzmann commented 9 months ago

I'm able to reproduce this on my side. Hopefully can patch a fix not too long from now

renzmann commented 9 months ago

Fixed in v0.6.9