dandavison / delta

A syntax-highlighting pager for git, diff, grep, and blame output
https://dandavison.github.io/delta/
MIT License
24.17k stars 391 forks source link

🚀 Integration with Graphtage or Difftastic #535

Open boris-petrov opened 3 years ago

boris-petrov commented 3 years ago

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?

dandavison commented 2 years ago

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?

  1. User can do graphtage a.json b.json | delta (but how is that any better than graphtage a.json b.json)?
  2. User can do delta a.json b.json and 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)
  3. Something else?
bew commented 2 years ago

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?

dandavison commented 2 years ago

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.

marcelarie commented 1 year ago

Is the support for difftastic available?

dandavison commented 1 year ago

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??)

marcelarie commented 1 year ago

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. 🤷🏽

Guekka commented 1 year ago

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

marcelarie commented 1 year ago

The PR on difftastic to output JSON has been successfully merged: https://github.com/Wilfred/difftastic/pull/158#issuecomment-1682537893

ding-weibing commented 10 months ago

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 --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??)

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.