I'm [email protected].
Then when the file goes into tree-sitter-mode, you can check the filetype again, and map that into the language to load into tree-sitter. Keep a buffer-local variable to remember that current language, so that you can use it for any additional language-specific customization that you want as well.
Keep in mind that there's nothing about a major mode in Emacs that has to be specific to a programming language. It's totally cool to have a major mode that works for multiple programming languages!
*Update:* I found the code. Instead of using font-lock, we simply draw our own overlays over the text and color them, which is what font-lock does. Font-lock IIRC is specifically designed to use regexps to parse the text. We don't need that. So throw font-lock away. Tree-Sitter itself knows how the parse tree maps to text regions. Just use that information to draw the overlays directly. It's way simpler that way.
Lemme know if anyone wants the code.
My elisp skills are basic, so I could help more with testing, coordination, publishing packages, or documentation.
Shall I create the repo?
Unfortunately, it wasn't as straightforward as I hoped. You need to create a custom major mode for your language and manually integrate the tree-sitter highlighting.
What I'd really like to see one day is an Emacs mode that allows you to automatically plug in any tree-sitter grammar with just a couple of lines of configuration in your .emacs, and instantly get syntax highlighting. Is that too much to ask?