difftastic
difftastic copied to clipboard
JSON output doesn't contain optional `MatchKind` data
Hello again!
I ran into an gap when trying to diff, example for simplicity:
// Original
println!("Hello, world!");
// New
println!("Hello, dear world!");
The terminal output knows to mark dear
specifically because it knows it is a NovelWord
vs the rest of the line, which is NovelLinePart
. However, the JSON output strips that away and leaves only the highlight (i.e. String
).
There are at least 2 ways about this, would love to contribute. Options I thought about:
- Drop
NovelLinePart
from the changes list as it is not a real change as far as I can tell. If we getNovelLinePart
it means the myers_diff found the string in both sides, right? - Add the MatchKind itself, as an str, to the JSON output. Something like this:
{ "changes": [ ... {"start":17,"end":21,"content":"dear","highlight":"string","highlight_type":"NovelWord"}, {"start":22,"end":27,"content":"world","highlight":"string","highlight_type":"NovelLinePart"} ] }
WDYT @Wilfred ? I'll be happy to contribute this