Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Integration with Graphtage or Difftastic #535

Open
boris-petrov opened this issue Mar 7, 2021 · 9 comments
Open

🚀 Integration with Graphtage or Difftastic #535

boris-petrov opened this issue Mar 7, 2021 · 9 comments

Comments

@boris-petrov
Copy link

boris-petrov commented Mar 7, 2021

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
Copy link
Owner

dandavison commented Dec 12, 2021

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
Copy link

bew commented Dec 12, 2021

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 dandavison changed the title 🚀 Use something like Graphtage for specific file types 🚀 Integration with Graphtage or Difftastic Dec 12, 2021
@dandavison
Copy link
Owner

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
Copy link

Is the support for difftastic available?

@dandavison
Copy link
Owner

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

@marcelarie
Copy link

marcelarie commented Apr 19, 2023

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
Copy link

Guekka commented Apr 19, 2023

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
Copy link

The PR on difftastic to output JSON has been successfully merged: Wilfred/difftastic#158 (comment)

@ding-weibing
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants