Offer the switch to the unified diff only when it is enabled - #2877
Merged
vogella merged 1 commit intoAug 14, 2026
Merged
Conversation
The compare editor showed the button that switches over to the unified diff for every comparison the unified diff can display, no matter whether the preference that enables the unified diff was set. The unified diff is still experimental, so the button now follows that preference and stays hidden while it is off. The check sits in canOfferUnifiedDiffSwitch next to canShowAsUnifiedDiff, which keeps answering from the structure of the comparison alone so that switching still works once the button was offered. A test covers both states of the preference for the same qualifying comparison.
tobiasmelcher
approved these changes
Aug 14, 2026
tobiasmelcher
left a comment
Contributor
There was a problem hiding this comment.
Thanks a lot. I tested it manually on my machine and the feature works as described.
Contributor
Author
|
Thanks @tobiasmelcher for the review. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The compare editor showed the button that switches an open comparison over to the unified diff for every comparison the unified diff can display, no matter whether the experimental preference that enables the unified diff was set. The button slipped into master with #2874 earlier than intended, and @tobiasmelcher asked in #2854 to gate it on that preference.
The button now follows the preference and stays hidden while it is off, so users who did not opt into the experiment do not see it. The check reads the same preference store that decides which editor an input opens in, which means the button appears exactly when reopening the same comparison would bring up the unified diff.
canShowAsUnifiedDiffstays free of the preference so that switching keeps working for an editor that was opened while the preference was on and had it turned off afterwards.The existing test class covers both states of the preference for a qualifying comparison, plus a comparison the unified diff cannot display while the preference is on.