Show context for diff view of merge conflict and introduce compareAll.#74231
Show context for diff view of merge conflict and introduce compareAll.#74231
Conversation
|
|
||
| let text = ''; | ||
| let lastPosition = new vscode.Position(0, 0); | ||
| ranges.forEach(rangeObj => { |
There was a problem hiding this comment.
We concatenate the before/after ranges to two new documents and then diff the two - if I understand correctly. This could result in a different diff than when comparing the two original before/after documents. Is that going to be a problem?
There was a problem hiding this comment.
This could result in a different diff than when comparing the two original before/after documents
Yes and no, let me elaborate more. No, because the after document is the file content on disk, which already resolves some conflicts successfully, so compareAll shows the difference of conflicts which are not resolved. From this perspective, the diff view of compareAll is correct.
Yes if we are thinking in a three-diff way. Say the users is trying to merge two branch, whose heads are A and B. A is upstream, and B is a branch you created a few weeks ago. After merging, there is a merge conflict. The diff view of compareAll is different from A --- B then. However in this case, a simple comparison between A and B doesn't really work as most changes in A --- B are probably not related to the work you are doing. To avoid confusion, you may want to see a three-way-diff editor, which represents the diff view between A, B and their common nearest ancestor. We can do this later on as it requires introducing a new diff algorithm and editor pane.

To improve the merge conflict resolve experience, a new setting
merge-conflict.diffViewContextwas added to show the context around the conflictBefore: there is no context around the diff

After: with

"merge-conflict.diffViewContext": 3A new command Compare All is introduced to display the full compare between current workspace and incoming changes, with which you can compare the old content, the incoming one, and the latest local content on disk