I can only see more editors just giving up on this and going all in of treesitter.
It's not only neovim, btw, the next emacs is also gonna have it included.
One other thing is the decentralisation of the TS grammar development. There's nothing wrong with people making their own grammars, but the shape of a TS parse tree for any given language changes according to the whims of the hundreds of individuals who seem to be maintaining them out in the wild. Projects like nvim-treesitter maintain their own highlighting queries, and also (AFAIK) manually update refs to commits on the upstream grammar repos to control the pace of change. They have to do this because the queries + the grammar have to be kept tightly in sync, if you refactor the grammar without updating the query file then a million people's neovim installs start spewing errors. And the grammars (largely) aren't controlled by language developers, so they lag behind features. So all this requires development of grammars in concert with all the applications of them. It's not like the LSP which formed a pretty low friction, low churn interface for independent development of all the code analysis servers. (They added features extremely fast, but an unchanged LSP server from 5 years ago probably still works unchanged.)
This situation is mostly acceptable for syntax highlighting in an editor, but maybe not for a code formatting tool that's meant to be authoritative and consistent between developers. Is Topiary going to maintain forks of two hundred grammars with their own queries? It's pretty ambitious. Which is why I'm not surprised they focused on one language, OCaml... it seems infeasible for TS to actually deliver on its potential here.
There SO MANY perfect tools for language implementation and ast manipulation..! Starting with ML family languages that are very good at this.
People have been looking for universal approach to parsing for so long... maybe there is one, maybe not, but treesitter was never meant to be one.
And it's great for what it does!
If you want to create a parser for a toy language that produces an AST or a single error, then sure, that's trivial. But if you want a parser that does good error recovery, produces a high fidelity CST, and reuses memory in an efficient manner (red-green trees ideally), that's a lot of work. And that's table stakes for good programming language tooling. We're not in the era of emacs plugins that do regex syntax highlighting and call it a day. If there was a framework that could accomplish this, and function as a parser for the compiler (which is not so crazy, since most modern compilers are also the engines for tooling, i.e. language servers)
I agree that tree-sitter was never meant to be a universal solution, but I think it's easily could be with some adjustments. And because of the existing infrastructure, because of the existing parsers, I think that it's reasonable to consider pushing tree-sitter in that direction instead of creating yet another parsing framework.
As somebody who came up with a couple of quick modes and parsers for Emacs and in Emacs Lisp I can say that for people like myself it's a blessing. I sincerely hate how there are numerous implementations of everything in dozens of editors out there, but nobody benefits from each others work in a reasonable way... Treesitter's universal community-centric approach kind of resonates with the stronger side of OSS: suddenly all of these little steps individuals do contribute to the ecosystem as a whole.
Now, admittedly, all I need is an axe. I know I need an axe, treesit gives it to me and this makes me a happy little contributor.
So let's say somebody comes up with a factory of a tool. All inside: properly incremental, smart error handling, tree editing, transformations and stuff. Something tells me it would much harder to contribute a simplified barely working grammar for that thing. And this kind of kills the point of emacsy-sh moonlight hacker tool.
It would be useful, sure, but would it work in practise?
Where I disagree is that IMO, tree-sitter already is very close to this ideal model. It has incremental parsing. It has great tree querying. Where it needs help is an AST facade over the raw syntax tree, which is very much feasible. rust-sitter[1] does it for instance. Tree-editing and tree construction is also very much doable. I don't think it'd have an impact on grammar construction at all. As for error recovery, I think it could function as a reparsing feature where you can drop down to a manual parser (or even a secondary grammar) that is more tolerant. Or an error recovery function that can be written in any language. tree-sitter already has the ability to use a manual lexer written in native code, so this is not such a stretch.
My only issue with it is that it really only does half the job. You get a CST of sorts, but if you want to do anything with it you pretty much have to hand write another parser for that node tree.
In contrast parser combinator libraries like Nom and Chumsky give you "the final output".
I keep wondering, there a reason everything isn’t just based off treesitter these days? If I were tasked with writing tsserver, my instinct would be to layer it over treesitter. Does anyone know if there are practical reasons that doesn’t happen, or is it just legacy?
The neovim world is slowly converging on using it for syntax. This project for formatting. I personally use it in neovim for things like highlighting and formatting sql within strings in python.