Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON output doesn't contain optional MatchKind data #658

Open
nimrodkor opened this issue Mar 13, 2024 · 0 comments
Open

JSON output doesn't contain optional MatchKind data #658

nimrodkor opened this issue Mar 13, 2024 · 0 comments

Comments

@nimrodkor
Copy link
Contributor

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:

  1. Drop NovelLinePart from the changes list as it is not a real change as far as I can tell. If we get NovelLinePart it means the myers_diff found the string in both sides, right?
  2. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant