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

Syncing hooks between tree-sitter and default modes

Open renzmann opened this issue 2 years ago • 3 comments

A reddit comment brought up the fact that it's annoying to manually sync hooks between tree-sitter and the default modes. Maybe add a switch like treesit-auto-sync-hooks that can be t or nil? Or maybe a customizable list for modes that should be synced?

renzmann avatar Jan 24 '23 15:01 renzmann

Instead of "syncing" hooks across modes, python-ts-mode and python-mode would it be better to recommend setting all their generic hooks and configs on python-base-mode? From briefly looking into the source code, I think every major mode that has a ts-mode derivative also has a base-mode that contains all the code and config that is generic across the two modes.

justinbarclay avatar Jan 31 '23 16:01 justinbarclay

That makes sense for legacy languages like Python, but not net-new languages like Go and Rust. If I'm trying to transition to go-ts-mode, which derives from prog-mode directly, but also have go-mode handy, I might want to apply the same hooks regardless of which one gets activated.

#12 would introduce treesit-auto--available-alist, however, which makes an implementation per the Reddit post considerably easier

renzmann avatar Feb 01 '23 21:02 renzmann

another thing worth thinking about is how this will play into styles. eg, it's tedious to set c style in two sets of variables -- one tree sitter one separate

gitrj95 avatar Feb 11 '23 04:02 gitrj95