A good time to also point out https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-...
Difftastic: Syntax-aware structured diff tool
61–62 of 62 posts
Re: Difftastic: Syntax-aware structured diff tool
#62Earlier quoted context omitted.
Yeah, so it's basically a lexer with an extremely simplistic parser. Compiler parsers aren't a great fit for difftastic. They discard comments, they may not give you output if there are syntax errors, and they're usually tied to a specific language version. Since this format works well for Comby (Rijnard's talk is excellent: https://www.youtube.com/watch?v=JMZLBB_BFNg ) I'm hopeful it's an adequate solution for Difft…
FWIW, as soon as I saw this project, I wondered specifically about Treesitter's applicability to this problem, and I found https://github.com/afnanenayet/diffsitter . Maybe there's something to be learned there?
I think some of the issues are alleviated because tree sitter was made with text editors in mind, so you're not really getting a compiler parser as editors still care about comments and whatnot. It's also fast, which was a big motivation to use it.