2 ms·
Tree-sitter is not just for code folding, it's a full-on incremental parser that's fast enough to run on every keystroke. See their expand selection example for
by lewisl9029 9y ago
Tree-sitter is not just for code folding, it's a full-on incremental parser that's fast enough to run on every keystroke. See their expand selection example for another really compelling use-case.
If you're interested in more details, there's also this talk from the developer behind tree-sitter (https://www.youtube.com/watch?v=a1rC79DHpmY https://www.youtube.com/watch?v=a1rC79DHpmY), where he showcases how they could use tree-sitter to quickly parse entire multi-megabyte minified JS files to provide complete syntax highlighting for them that updates as you edit, and how the accuracy and usefulness of the actual syntax highlighting can improve over regex based implementations due to having access to the fully specified grammar of the language.
I think tree-sitter is also a game changer for extension development once it stabilizes and the APIs are opened up. Extensions like swackets will no longer have arbitrary performance constraints that break user experience (https://atom.io/packages/swackets https://atom.io/packages/swackets), and it opens the door to a whole new set of intelligent extensions that understand the languages you write at a much deeper level that were previously unfeasible due to parsing performance, or required some external heavy-weight language server.