Repository navigation
Add dedicated overview-ruler annotation types for unified diff - #3004
Open
tobiasmelcher wants to merge 1 commit into
Open
tobiasmelcher wants to merge 1 commit into
tobiasmelcher wants to merge 1 commit into
Conversation
Contributor
Test Results 51 files ± 0 51 suites ±0 58m 6s ⏱️ +45s For more details on these failures, see this check. Results for commit 20e5e87. ± Comparison against base commit 8b229d0. ♻️ This comment has been updated with latest results. |
Eclipse annotation types declared in markerAnnotationSpecification share a
single colorPreferenceValue for both the editor text highlight (drawn by
AnnotationPainter) and the overview ruler (drawn by OverviewRuler). The
unified-diff highlights must stay light pastels (229,242,229 for additions,
255,229,229 for deletions) so they remain readable behind source code. The
OverviewRuler fades every color 75% towards the background for its fill and
20% for its 1px border, so with those pastels both the fill and the border
become virtually invisible on the ruler. Calling setUseSaturatedColors(true)
is not an option: it is global and would ruin the saturation of every other
annotation in the editor (warnings, search results, bookmarks, etc.).
Decouple the editor text highlight from the overview ruler by introducing two
dedicated ruler-only annotation types, addition.ruler and deletion.ruler. The
existing addition/deletion types keep painting the pastel text highlight and
no longer paint on the ruler; the new types carry saturated, high-contrast
colors (40,140,40 and 220,50,50) and paint only in the overview ruler. They
also carry the tooltip text ("Addition at line N", "Deletion from line M to
N") so hovering a ruler tick shows a human-readable description. The detailed
diff types (detailedAddition, detailedDeletion) are left unchanged.
Also drop the unused symbolicIcon="info" from the four pre-existing inline
diff specs. The icon was never shown because all four set
verticalRulerPreferenceValue and contributesToHeader to false.
tobiasmelcher
force-pushed
the
d031119/unified-diff-ruler-annotations
branch
from
October 9, 2026 14:49
c662b0a to
20e5e87
Compare
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.
Closes #2941
What
Adds overview-ruler markers for top-level unified-diff hunks. Until now the
unified diff presentation highlighted differences only in the visible editor
area and showed nothing on the overview ruler, so off-screen differences were
hard to discover and navigate.
This is done by introducing two dedicated overview-ruler annotation types:
org.eclipse.compare.unifieddiff.internal.addition.rulerorg.eclipse.compare.unifieddiff.internal.deletion.rulerThey paint only on the overview ruler, with saturated, high-contrast
colors (
40,140,40green and220,50,50red) and a sharp 1px border. Eachruler annotation also carries a human-readable tooltip ("Addition at line N",
"Deletion from line M to N") shown when hovering a ruler tick. The existing
addition/deletiontypes continue to paint the pastel text highlight inthe editor and are untouched. Detailed/token-level diff annotations
(
detailedAddition,detailedDeletion) deliberately produce no rulermarkers.
Why two new types instead of reusing the existing annotations
In Eclipse, an annotation type declared in
markerAnnotationSpecificationuses a single
colorPreferenceValuefor both the editor text highlight(drawn by
AnnotationPainter) and the overview ruler (drawn byOverviewRuler).must be light pastels (
229,242,229for additions,255,229,229fordeletions).
OverviewRulercomputes its fill by fading the color 75% towards thebackground, and its 1px border by fading it 20% towards the background. With
those pastels, both the fill and the border become virtually invisible on
the ruler.
setUseSaturatedColors(true)is not anoption: it is global and would ruin the saturation of every other annotation
in the editor (warnings, search results, bookmarks, etc.).
Dedicated ruler-only annotation types let each side use the color it needs:
pastel for a readable in-text highlight, saturated for a clearly visible ruler
tick, without touching any other annotation in the workbench.
Notes
symbolicIcon="info"is dropped from the four pre-existinginline-diff specs. The icon was never shown because all four set
verticalRulerPreferenceValueandcontributesToHeadertofalse.The standard
errorandwarningoverview-ruler annotations also set nodark-theme override in
org.eclipse.ui.themes— they use theircolorPreferenceValuedefaults unchanged in both themes. The newaddition.ruler/deletion.rulertypes follow the same convention forsymmetry.
This change was prepared with the help of Claude Code.