Open cuviper opened 3 years ago
Yeah, this is sometimes called a "slider", and difftastic isn't completely immune.
I have been thinking about trying to nudge the diff logic to avoid blank lines, but it might increase complexity. The best solution for Rust here is probably to improve the tree-sitter parser to include the attribute with the function definition.
I'm seeing the exact slider behavior described above, in Difftastic 0.31.0, in my codebase (redacting the test function body, private and probably not relevant):
However, it does get the above indexmap
example right:
Not sure what the difference is. Maybe these just fall on either side of some heuristic threshold?
Using the indexmap repo, I tried the following command:
and got this output near the end:
Notice how the
#[test]
attribute is interpreted, where the following one is considered to be an insertion, instead of the one that's on the new function. This kind of thing is very common with line-based diffs, although plaingit show
actually does get this right!