Yeah using a single cache would probably result in a lot of misses since Emacs don’t fontify the whole buffer at once.
While it's true that Emacs doesn't fontify whole buffers under the current scheme, based on what I've read of tree-sitter (caveat: a fairly long while back), I think it might be reasonable to move to a whole-buffer-and-repair strategy for emacs+treesit, and that might provide some nice simplification along the way. Is there a good way to try this strategy now? I avoid JS whenever possible, and that seems like it might be the current-best test case...
Thanks,
~Chad