🚀 Integration with Graphtage or Difftastic
I stumbled upon Graphtage and found it a cool idea. It would be nice if delta could integrate it (and other projects like it - "semantic diffs") for specific file types. What do you think?
Hi @boris-petrov sorry to be so slow replying to this one.
Can you be explicit about what sort of integration might make sense? It doesn't look like graphtage produces diff format AFAICS. So are you thinking of any of the following?
- User can do
graphtage a.json b.json | delta(but how is that any better thangraphtage a.json b.json)? - User can do
delta a.json b.jsonand have graphtage-like output (ok, but that is tantamount to re-implementing graphtage in Rust; delta is really a diff viewer not a diff generator) - Something else?
FYI there's a project similar to delta that does exactly this (in Rust): https://github.com/Wilfred/difftastic (not as pretty/configurable as delta though)
Maybe there's some inspiration to take here?
FYI there's a project similar to delta that does exactly this (in Rust): https://github.com/Wilfred/difftastic
Right, difftastic looks great. I'd seen it before and meant to look more closely. One form of integration there could perhaps be difftastic emitting JSON and delta displaying it.
Is the support for difftastic available?
Is the support for difftastic available?
Not as far as I know. Looks like one path would be if a PR like this one is merged in difftastic: https://github.com/Wilfred/difftastic/pull/158
and then someone implements rendering of that JSON in delta. Delta already renders ripgrep --json output, so perhaps that implementation will be helpful when working on the difftastic JSON. (I guess in an ideal world there would be a standard format for describing token-level diffs regardless of their provenance; perhaps then difftastic and git diff --word-diff output could be the same format??)
Ok thanks for the info. As far as I know, JSON is not the fastest to parse, right? Maybe something more raw would be better. 🤷🏽
As far as I know, JSON is not the fastest to parse, right? Maybe something more raw would be better. 🤷🏽
I don't think that's an issue. Parsing JSON can be very fast. And diffing is way more expensive than any parsing could be
The PR on difftastic to output JSON has been successfully merged: https://github.com/Wilfred/difftastic/pull/158#issuecomment-1682537893
Is the support for difftastic available?
Not as far as I know. Looks like one path would be if a PR like this one is merged in difftastic: Wilfred/difftastic#158
and then someone implements rendering of that JSON in delta. Delta already renders
ripgrep --jsonoutput, so perhaps that implementation will be helpful when working on the difftastic JSON. (I guess in an ideal world there would be a standard format for describing token-level diffs regardless of their provenance; perhaps then difftastic andgit diff --word-diffoutput could be the same format??)
Hi @dandavison,
Based on the recent discussion at Delta Issue #535, it seems there might be an opportunity to address the support issue with difftastic. While I am not highly familiar with Rust, I am eager to contribute to this effort. If you could guide me on which parts of the code require modifications, I would be delighted to make a commit. Thank you for your assistance and insight.