April 16, 2026

When grammar gets a standing O

A Better R Programming Experience Thanks to Tree-sitter

Fans hail smoother R coding; veterans clap back: “we had this ages ago”

TLDR: A new R “grammar” for Tree-sitter is making editors understand R code better, unlocking cleaner formatting and smarter help. Commenters praised the engineering, questioned whether it handles R’s quirky pipelines, reminded everyone RStudio had similar perks, and one dev instantly built a VS Code tool—proof it’s a big deal.

Yes, a crowd literally applauded a “grammar file.” But it wasn’t for commas—it was for what it unlocks. The R world is buzzing over a new Tree-sitter “grammar,” a way for computers to read R code like sentences, powering cleaner formatting, smarter linting, and slick pop-up help. Fans like epistasis are swooning, calling it top-tier engineering. Curious minds want receipts: fn-mote asks if it can handle R’s quirky “pipe” style and bare column names—if it does, that’s a wow. Emacs folks chimed in too: TacticalCoder says it’s easier than it looks, already using it to fix stubborn code layouts.

Then the plot twist: nomilk rolled in with the reality check—“autocompletion and hover help” aren’t new; RStudio had them for years. Translation: don’t act like you invented the wheel. Meanwhile, builder energy is off the charts: tylermw read the post and promptly shipped a VS Code add-on for “targets” pipelines, proving this isn’t just hype. Under the hood, it’s all powered by Tree-sitter, which makes editors understand code better and fuels features in new tools like the Positron IDE.

The vibe: half victory parade, half “we’ve had nice things, thanks.” The real question isn’t whether it’s good—it’s whether it can tame R’s weirdest tricks. Also, yes, we’re still laughing at the idea of cheering for grammar rules. Only in R-land.

Key Points

  • Davis Vaughan completed an R grammar for Tree-sitter, building on work by Jim Hester and Kevin Ushey, enabling improved R tooling.
  • Tree-sitter is a C-based code parsing generator with bindings in languages including Rust and R.
  • The R Tree-sitter grammar powers reformatting (Air), linting (Jarl), IDE features in Positron, and better R search on GitHub.
  • R can natively parse code using parse() and getParseData(); grammar changes (e.g., native pipe) modify R’s syntax.
  • Parsed R code can be transformed into XML using the xmlparsedata package and handled with xml2, demonstrating tooling workflows.

Hottest takes

“Tree-sitter is one of the finer engineering products out there, it enables so much.” — epistasis
“auto completion and help on hover are new things, but RStudio IDE has had them for years and years.” — nomilk
“immediately implemented a VS Code extension that I've always wanted” — tylermw
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.