ryu1kn / vscode-partial-diff

Visual Studio Code Extension. Take a diff of 2 parts of text(s)
https://marketplace.visualstudio.com/items?itemName=ryu1kn.partial-diff
MIT License
184 stars 15 forks source link

View character differences on lines #60

Open gtomic opened 3 years ago

gtomic commented 3 years ago

When diffing 2 files partialdiff does not differentiate WHAT changed on the line - just that the line was changed. So as an example it shows the following 10 lines image

When comparing the same file in Notepad++ it properly shows that the lines are almost exactly the same - just the code addresses are different.

image

Is there a way to enable such a view in partialDiff? I've searched the web, tried multiple settings and so far unsuccesful

ryu1kn commented 3 years ago

Hi @gtomic , yeah that doesn't look right. On line 1, you can see what's changed on that line (d removed from suspedct and 1123 droped from the last).

However on line 4-10, looking at the colour difference on the background of line number and the editor contents, the entire lines seem to be recognised as the changed parts (more solid red/green).

I extracted the text from your image using an online text extraction service and took the diff. Here is what it presented to me. Do you have specific steps to reproduce the issue?

image

Partial Diff: 1.4.1 Code: 1.52.1 OS: macOS

gtomic commented 3 years ago

If I take your text 1 and 2 examples (which were originally from my partial screen shot) it works for me but if I take the full file that contains the entire stack trace it doesn't work so it appears to be something in the file content that causes it to exhibit the behavior. I've attached both example files that don't work for me. Can you see if it using the full files works for you?

File 1 kestrel.log.filterline.log

File 2 kestrel1.log.filterline.log

I'm running the following brand new installation of VS Code Version: 1.52.1 (user setup) Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523 Date: 2020-12-16T16:34:46.910Z Electron: 9.3.5 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Windows_NT x64 10.0.19041

ryu1kn commented 3 years ago

Thanks, I can reproduce the behaviour. The same thing happens if I use Code's native "Compare Selected" feature. Wonder if it's a problem in the Code's diff viewer.

image

ryu1kn commented 3 years ago

By the way, if different 0x... values are making the diff noisy, you might find partialDiff.preComparisonTextNormalizationRules settings useful. You can add an entry like this.

"partialDiff.preComparisonTextNormalizationRules": [
    {
      "name": "Ignore HEX addresses",
      "match": "\\[0x[0-9a-f]{12}\\]",
      "replaceWith": "[0x000000000000]"
    }
]