4 ms·
Tree-sitter (intelligent code folding) looks really cool. While I am a big fan of VSCode, I really do not like their indentation-only approach to folding. It ma
by jakear 9y ago
Tree-sitter (intelligent code folding) looks really cool. While I am a big fan of VSCode, I really do not like their indentation-only approach to folding. It makes constructs like C switch statements impossible to fold correctly. Something like:
switch( ) {
case:
break;
case:
break;
}
won't fold at the braces, but instead will just collapse one case statement, and it drives me crazy. This is even with the C/C++ language extensions installed.
Good job Atom.
- dualogy 9y agoVSC has been on the case lately too though FWIW: https://code.visualstudio.com/updates/v1_21#_folding https://code.visualstudio.com/updates/v1_21#_folding
- lewisl9029 9y agoTree-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.