News for hackers. Stuff that matters.
Re:Diffsitter: A tree-sitter based AST difftool to get meani... by iwwr on Sunday July 18, 2021 @03:17PM (#27875703)
Is this tool obsoleted by autoformatters?
Re:Diffsitter: A tree-sitter based AST difftool to get meani... by craftkiller on Sunday July 18, 2021 @03:27PM (#27875820)
It could be useful if it was modified to become a great merge tool. I've been using kdiff3 as my git mergetool and its always splits my code up at the worst spots because it does not understand python.
Re:Diffsitter: A tree-sitter based AST difftool to get meani... by codetrotter on Sunday July 18, 2021 @03:21PM (#27875762)
Not unless you you have a git hook to ensure that every commit is run through the auto formatter, and you additionally ensure that everyone that commits to the repositories you work on have this hook installed too. And even then, many people still interact with repositories that are outside of their power to enforce such rules upon.
Re:Diffsitter: A tree-sitter based AST difftool to get meani... by sahkopoyta on Sunday July 18, 2021 @05:24PM (#27876814)
>git hook to ensure that every commit is run through the auto formatter, and you additionally ensure that everyone that commits to the repositories you work on have this hook installed too

Eg. with node project this is a trivial task with tools like Husky in place

Re:Diffsitter: A tree-sitter based AST difftool to get meani... by kevincox on Sunday July 18, 2021 @07:10PM (#27877533)
Not necessarily. You could also run the "unformatted" files through the formatter before doing the diff.
Re:Diffsitter: A tree-sitter based AST difftool to get meani... by polynomial on Sunday July 18, 2021 @04:00PM (#27876133)
sorry for the dumb question but why can't you use GH Actions for this? (Instead of making sure all committers have the hook installed.)
Re:Diffsitter: A tree-sitter based AST difftool to get meani... by fierro on Sunday July 18, 2021 @04:49PM (#27876543)
no, because the bigger win isn't ingoring whitespacing. It's ignore refactoring changes like renaming functions
Re:Diffsitter: A tree-sitter based AST difftool to get meani... by affyboi on Monday July 19, 2021 @01:03AM (#27879443)
Not if they do any sort of alignment (like structs in golang)
Re:Diffsitter: A tree-sitter based AST difftool to get meani... by erik_seaberg on Monday July 19, 2021 @03:59AM (#27880252)
This tool works with the author’s intended layout, a big advantage over autoformatters which destroy and replace it poorly (it’s probably an AI-complete problem).