A Better R Programming Experience Thanks to Tree-sitter
a day ago
- #Tree-sitter
- #developer tools
- #R programming
- Tree-sitter is a code parsing generator with bindings in several languages, enabling fast and incremental parsing for various programming languages, including R.
- An R grammar for Tree-sitter was developed, improving developer tools such as syntax highlighting, autocompletion, and code navigation in environments like GitHub and Positron.
- The {treesitter} R package allows parsing and querying R code, supporting packages like {gander} for LLM interactions and {igraph.r2cdocs} for documentation linking.
- Tools like ast-grep (with R wrapper {astgrepr}) and CLIs Air and Jarl leverage Tree-sitter for code refactoring, linting, and formatting efficiently.
- Tree-sitter is used in mutation testing ({muttest}), structural diffing (difftastic), and parsing other languages like C via {treesitter.c}, expanding its utility in R development.