4 ms·
There is also diffsitter. I was testing it a month ago, it works fine. Not sure what language-aware diffing exactly means, but diffsitter uses tree-sitter and i
by emporas 2y ago
There is also diffsitter. I was testing it a month ago, it works fine. Not sure what language-aware diffing exactly means, but diffsitter uses tree-sitter and it is comparing ASTs and CSTs of the files.
[1] https://github.com/afnanenayet/diffsitter https://github.com/afnanenayet/diffsitter
- sureglymop 2y agoSeems to be the best choice since treesitter is already generic and supports many languages. Will try this out first.
- emporas 2y agotree-sitter is very generic and supports so many languages, it is really great. The first use case of the article, "Level 1: Irrelevant Whitespace" is covered by diffsitter. I wanted at some point, to diff files and ignore comments for Rust source code. I wrote a small program, to remove the two different comment nodes the Rust grammar defines: line_comments and block_comments. Then i diffed the resulting uncommented code using diffsitter. From start to finish, writing the program and testing it to many different files it took 5 hours.