-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Make diff line matching more robust #1068
Conversation
|
There are problems with this approach. For example, I created this PR: grokys/PullRequestSandbox#29 As you can see, I added a comment on line 22, but in VS with this PR, this is showing up on line 15: |
|
@grokys Well spotted. 😄 I've been wondering about how to make it more robust. Could you try this latest push. It will match using all available context lines before falling back to matching using the original line number. Still not perfect, but I wonder if this will end up being about getting the balance right (false positives vs false negatives). |
|
It now shows the unedited file with the comments in the correct place, but when I delete the |
|
From @grokys on the Slack: I'm going to push a version that fixes the original issue. It was trying to match 5 lines of context when the diff only had 3. |
09b044f to
af9dfaa
Compare
|
I've just pushed more of a point fix that should resolve just this issue. Hopefully 3rd time's a charm? 😉 |
grokys
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
|
I've done some more testing on .com this seems to behave very similarly. Sometimes .com requires less than 5 lines of context, but when I noticed this the API returned only 4 lines so the extension actually behaved in a similar way. |

This PR matches diff lines based on their original line number and content.
Fixes #1052