What does HackerNews think of difftastic?

a structural diff that understands syntax 🟥🟩

Language: Rust

There is a diff tool called difftastic: https://github.com/Wilfred/difftastic

The idea is that it does not show diff based on text change, but on syntastic meaning. For that, it uses tree-sitter.

I think it still shows the trailing comma in the situation as shown in the article, but it's quite different experience than the standard text based diff.

Yay, nice! finally a simple cli for treesitter.

treesitter tech always seemed cool, but never felt I had access to it on my finger tips. one such tool is https://github.com/Wilfred/difftastic (semantic diff)

will definitely be trying this out.

https://github.com/TimUntersberger/neogit & DiffView if I want everything inside neovim.

If I am just living in the terminal, I like to use a mix of https://github.com/extrawurst/gitui (doesn't support signed commits yet!) and https://github.com/Wilfred/difftastic which provides amazing semantic diffs.

This, of course, isn't exactly what you want, but what about difftastic?[0] It claims it supports JSON [1]

[0] https://github.com/Wilfred/difftastic [1] https://difftastic.wilfred.me.uk/languages_supported.html

Although, I do not have much to add; using `difftastic`[0] & `delta` [1] is a very cool combo to make _git_ a little more approachable for newbies like me.

I use delta as my daily driver but sometimes when I want the contextual info, switching to `env GIT_EXTERNAL_DIFF=difft git log -p --ext-diff` gives a better picture.

[0]: https://github.com/Wilfred/difftastic

[1]: https://github.com/dandavison/delta

> It's in JS and not Python

it's in Rust:

https://github.com/Wilfred/difftastic

what am i missing?

Several threads here point to difftastic: https://github.com/Wilfred/difftastic

I know a lot of people who have a lot of hope for diffsitter (or something like it): https://github.com/afnanenayet/diffsitter

Personally, I think the reason most "good" semantic diff tools are proprietary is that they are huge amounts of effort that are mostly "hacks" and "heuristics" bandaged together in ways that people don't want to let out how the sausage was made.

But I also think "general, language agnostic AST-based semantic diff" is a mountain peak we cannot reach (probably ever), and I believe my experiments found an interesting local maxima that people are maybe passing by on the way to that ideal mountain (lexer-based diffs rather than parser-based diffs): https://github.com/WorldMaker/tokdiff

I personally believe that making diffs more human friendly is the next step of evolution we need. I work with a team on a NodeJS+React project and nearly every other PR shows up as "Something changed in package.json, something changed in package-lock.json, some static assets added/modified, some JSON changed" etc and it makes reviewing code quite unwieldy (esp. since it forces folks to use Github UI interface to even see blob diffs. which is quite opinionated on when it collapses a file in the PR, and how it determines what changed in a file). I feel like git was perfect when "code" was nearly almost completely text and patches were sent over email, but there's a lot more boilerplate+blob data that goes into git today and git needs to evolve to support this.

I feel that once tools like Difftastic [1] and similar get more mainstream, and ideally more firmly entrenched within git itself, it will make code reviewing much smoother process rather than having to depend on Github or any other proprietary service.

[1] https://github.com/Wilfred/difftastic

> Semantic diff – Can we figure out how to use version control to have more context-aware merges? Can you believe that we still rely on a text diffing algorithm from 1976 (and its shortcomings)? Git still has trouble with file renaming. GitHub Copilot, but for merge conflicts? Semantic diff has been tried before, but language-specific implementations will likely never work.

in case anyone missed it: https://github.com/Wilfred/difftastic

There are starting to be more code-aware diff tools.

https://github.com/Wilfred/difftastic

I'm currently trying this out, but I'm not sure if I'll keep using it.