Use "natural" diff order by default in compare editor#2566
Use "natural" diff order by default in compare editor#2566iloveeclipse wants to merge 3 commits intoeclipse-platform:masterfrom
Conversation
|
Test failures are to expect, let see how many. |
Change left/right diff elements in refactoring wizard to get proper diff coloring. This would make the "diff order" consistent with the **current** Eclipse diff order, which is, let say, "unusual" for a very long time (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=213780). That is also the reason the refactoring wizard had always "swapped" the input sides, being inconsistent to provide expected usability. However the coloring can be consistent only if the diff order is default one, and since diff coloring was added, refactoring wizard "hack" became visible. See also eclipse-platform#3776. This PR depends on eclipse-platform/eclipse.platform#2566 to avoid unexpected change of the "usual" diff order in the refactoring wizard. Fixes eclipse-platform#3775
There was a problem hiding this comment.
Pull request overview
Adjusts Eclipse Compare so the default presentation uses “natural” diff ordering (base/original on the left, local/modified on the right), aligning with the linked issue and reducing user confusion.
Changes:
- Set the default compare preference to open in mirrored (swapped) mode.
- Fix
MirroredMergeViewerContentProviderto correctly mirror left/right error reporting. - Update
TextMergeViewerTestinputs for the new default ordering and add a test-only workaround to avoid a modal dialog during a copy+modify scenario.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java |
Updates test setup for swapped-by-default ordering and adds test flags to suppress a modal dialog. |
team/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MirroredMergeViewerContentProvider.java |
Ensures left/right error setters mirror correctly when the provider swaps sides for display. |
team/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java |
Changes the default preference so compare opens mirrored/swapped by default. |
Comments suppressed due to low confidence (1)
team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java:414
- This test now initializes the DiffNode with content on the model right side and then calls
viewer.copy(true /* leftToRight */)followed bygetDocument(false /* right */)edits. With mirroring enabled by default, the displayed right document corresponds to the model left contributor, so the post-conditions should asserttestNode.getLeft()was updated (notgetRight()).
viewer.copy(true /* leftToRight */);
IDocument doc = getDocument(false /* right */);
doc.set(newText);
saveViewerContents();
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java
Outdated
Show resolved
Hide resolved
team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java
Outdated
Show resolved
Hide resolved
team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java
Outdated
Show resolved
Hide resolved
team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java
Outdated
Show resolved
Hide resolved
Prepare the test to be executed with swapped left/right logic. See eclipse-platform/eclipse.platform.ui#3776
It seems it was missing from very beginning. See eclipse-platform/eclipse.platform.ui#3776
Left is base/original, right is local/modified See eclipse-platform/eclipse.platform.ui#3776
1e9f9e6 to
73dddd4
Compare
There was a problem hiding this comment.
Pull request overview
Adjusts Eclipse Compare UI to use the “natural” left/right ordering by default (base/original on the left, local/modified on the right), aligning the compare editor’s default presentation with the expectation in eclipse-platform/eclipse.platform.ui#3776.
Changes:
- Flip the default for the
ComparePreferencePage.SWAPPEDpreference to enable mirroring by default. - Fix
MirroredMergeViewerContentProviderto correctly swap left/right error routing. - Update
TextMergeViewerTestto account for mirrored orientation when invoking copy/edit operations.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
team/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/TextMergeViewerTest.java |
Adjusts merge/copy/edit tests to behave correctly when the compare viewer is mirrored by default. |
team/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MirroredMergeViewerContentProvider.java |
Swaps left/right error delegation to match the mirrored (display-swapped) semantics. |
team/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java |
Changes the default value of the “Swap left and right” preference to true (mirrored by default). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Left is base/original, right is local/modified
See eclipse-platform/eclipse.platform.ui#3776