Skip to content

Use "natural" diff order by default in compare editor#2566

Open
iloveeclipse wants to merge 3 commits intoeclipse-platform:masterfrom
iloveeclipse:issue_3776_order
Open

Use "natural" diff order by default in compare editor#2566
iloveeclipse wants to merge 3 commits intoeclipse-platform:masterfrom
iloveeclipse:issue_3776_order

Conversation

@iloveeclipse
Copy link
Member

Left is base/original, right is local/modified

See eclipse-platform/eclipse.platform.ui#3776

@iloveeclipse
Copy link
Member Author

Test failures are to expect, let see how many.

iloveeclipse added a commit to iloveeclipse/eclipse.platform.ui that referenced this pull request Mar 13, 2026
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
@github-actions
Copy link
Contributor

github-actions bot commented Mar 13, 2026

Test Results

    54 files  ±0      54 suites  ±0   35m 12s ⏱️ - 1m 53s
 4 546 tests ±0   4 523 ✅ +1   23 💤 ±0  0 ❌  - 1 
12 234 runs  ±0  12 075 ✅ +1  159 💤 ±0  0 ❌  - 1 

Results for commit 1e9f9e6. ± Comparison against base commit 2776d6f.

♻️ This comment has been updated with latest results.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MirroredMergeViewerContentProvider to correctly mirror left/right error reporting.
  • Update TextMergeViewerTest inputs 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 by getDocument(false /* right */) edits. With mirroring enabled by default, the displayed right document corresponds to the model left contributor, so the post-conditions should assert testNode.getLeft() was updated (not getRight()).
			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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.SWAPPED preference to enable mirroring by default.
  • Fix MirroredMergeViewerContentProvider to correctly swap left/right error routing.
  • Update TextMergeViewerTest to 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.

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

Successfully merging this pull request may close these issues.

2 participants