Better Git diff with difftastic

Wait 5 sec.

[This article was first published on Maëlle's R blog on Maëlle Salmon's personal website, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.I’m currently on a quest to better know and understand treesitter-based tooling for R.To make it short, treesitter is a tool for parsing code, for instance recognizing what is a function, an argument, a logical in a string of code.With tools built upon treesitter you can search, reformat, lint and fix, etc. your code.Exciting stuff, running locally and deterministically on your machine.Speaking of “etc.”, Etienne Bacher helpfully suggested I also look at treesitter-based tooling for other languages to see what’s still missing in our ecosystem.This is how I stumbled upon difftastic by Wilfred Hughes, “a structural diff tool that understands syntax”. This means that difftastic doesn’t only compare line or “words” but actual syntax by looking at lines around the lines that changed (by default, 3),Even better, it understands R out of the box1.Many thanks to Etienne Bacher not only for making me discover difftastic but also for useful feedback on this post!Installing difftasticTo install difftastic I downloaded a binary file for my system from the releases of the GitHub repository,as documented in the manual.difftastic on two filesYou can run difftastic on two files, a bit like you would use the waldo R package on two objects.Let’s compare:a