Introduce Unified Diff display mode to Compare editor#2560
Introduce Unified Diff display mode to Compare editor#2560tobiasmelcher wants to merge 5 commits intoeclipse-platform:masterfrom
Conversation
|
Looks amazing |
|
I very much like that feature. I would be in favor of integrating a usable state as early as possible and incrementally improve it, so that it becomes easy to test and so that you get feedback soon. You currently seem to introduce new API with the |
|
@tobias-melcher can you finish this one? Would be awesome to have this as option (hopefully the default 1-2 releases later). |
For me github shows by default a split view (what often is a bit better than the eclipse one but that's a different story) and one has to explicitly select "unified" - so I don't think one is the "default" over the other but its just two options one can switch between and depends on preference of the user. |
Sure, I will do my best. I think the most important topic is that we get rid of the reflection calls. I will concentrate on this topic in the next weeks. I understand the request to make this feature available as early as possible and mark it as experimental. I will do this. |
list Adds a new public API method `getMinings()` to `AbstractInlinedAnnotation` that provides read-only access to the list of `ICodeMining` instances associated with an inlined annotation. This API is needed to implement the unified diff feature via eclipse-platform/eclipse.platform#2560
2f247d4 to
d2dd3df
Compare
and add "EXPERIMENTAL" to the preference label
@HeikoKlare I marked the package as "provisional API" and added "EXPERIMENTAL" to the preference label with [900a124]. Would you prefer to add "internal" to package "org.eclipse.compare.unifieddiff" or is x-internal sufficient? |
list Adds a new public API method `getMinings()` to `AbstractInlinedAnnotation` that provides read-only access to the list of `ICodeMining` instances associated with an inlined annotation. This API is needed to implement the unified diff feature via eclipse-platform/eclipse.platform#2560
| private UnifiedDiff() { | ||
| } | ||
|
|
||
| public static enum UnifiedDiffMode { |
There was a problem hiding this comment.
Since this is API, I think using an enum here means that adding enum constants is a backwards incompatible change? Should this be updated to allow for adding new values without breaking compatibility?
There was a problem hiding this comment.
thanks a lot for the feedback @danthe1st . I have replaced the enum with a type-safe constant class [af1f8ef]. Do you have any further feedback?
I’d also like to better understand the compatibility concern: is adding an additional enum value really considered binary incompatible? If so, could you please point me to the relevant documentation that explains why enums are not allowed in Eclipse APIs?

Add Unified Diff Display in Text Editor as Alternative to Classic 2-Way Compare
Implements eclipse-platform/eclipse.platform.ui#3771
Summary
This contribution introduces a new Unified Diff viewing mode for
org.eclipse.comparethat displays differences in a single editor pane, similar togit diffor GitHub's pull request view. When enabled, it replaces the traditional side-by-side 2-way compare editor for read-only comparisons, providing a more compact and familiar diff experience.This is a draft implementation to gather early feedback from the Eclipse community on:
What's Included
1. New Public API (
org.eclipse.compare.unifieddiff)Added a new public package with the
UnifiedDiffclass as the main entry point for programmatically opening unified diffs in text editors.Supported Modes:
API Example:
2. Preference Page Integration
Added a new checkbox in Preferences > General > Compare/Patch:
When enabled, eligible compare operations automatically use the unified diff viewer instead of the traditional side-by-side editor.
3. Automatic Compare Editor Integration
Modified
CompareUIPlugin#openCompareEditor()to detect when unified diff should be used:How to Test
Prerequisites
Steps
Expected Result:
Next Steps