A little bit less than two years ago, building on work by Jim Hester and Kevin Ushey, Davis Vaughan completed a very impactful JavaScript file for the R community: an R grammar for the Tree-sitter parsing generator. He even got a round of applause for it during a talk at the useR! 2024 conference! So, did he get cheered for… grammatical rules in a JavaScript file? 😅
No, the audience was excited about the improved developer experience for R that this file unlocked. R tooling around Tree-sitter is how you get
reformatting through Air and linting through Jarl;
auto-completion or help on hover in the Positron IDE;
better search for R on GitHub;
and more!
In this post, we’ll explain what Tree-sitter is, and how tools built on Tree-sitter can benefit your R development workflow.
🔗 Code parsing: what is Tree-sitter?
Tree-sitter is a code parsing generator written in C, with bindings existing in several languages including Rust (and R!).
Let’s rewind a little bit. What does it mean to parse code?
... continue reading