Repository navigation
SCM Graph - truncate long reference names in the history item hover - #348386
Open
Ladislau Szomoru (lszomoru) wants to merge 2 commits into
Open
Ladislau Szomoru (lszomoru) wants to merge 2 commits into
Ladislau Szomoru (lszomoru) wants to merge 2 commits into
Conversation
Long branch/tag names wrapped inside the reference badges in the graph hover, turning the pill-shaped badges into multi-line blocks. Keep each badge on a single line, capped at the hover width with an ellipsis, and expose the full reference name as the badge title. Fixes #235620 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The hover CSS relies on a four-section layout, leaving long reference names untruncated for commits without statistics; the references section needs an explicit styling marker.
1 open issue
What changed in this PR
This PR addresses #235620 by keeping long branch and tag badges compact in VS Code’s SCM Graph history hover while preserving access to their full names.
Changes:
- Adds single-line, width-limited badge styling with ellipsis.
- Adds full-name titles, escaping HTML attributes and dollar signs to prevent theme-icon rewriting.
| File | Description |
|---|---|
src/vs/workbench/contrib/scm/browser/scmHistory.ts |
Adds safely encoded full-reference titles to hover badges. |
src/vs/workbench/contrib/scm/browser/media/scm.css |
Adds width limits and ellipsis styling for reference badges. |
Review effort: Balanced
Target the references section by an explicit class instead of its position, so the badge layout and truncation also apply when the hover has no short statistics section (e.g. for an empty commit). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ladislau Szomoru (lszomoru)
marked this pull request as ready for review
November 15, 2026 19:00
Ladislau Szomoru (lszomoru)
enabled auto-merge
November 15, 2026 19:00
This branch has not been deployed
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.

Fixes #235620
Repro steps
git branch feature/a-very-long-branch-name-that-keeps-going-and-going-to-check-how-the-scm-graph-hover-handles-long-refsandgit tag release/2026.11.14-a-very-long-tag-name-that-also-keeps-going-to-check-how-the-scm-graph-hover-renders-it.Root cause
toHistoryItemHoverContent(scmHistory.ts) injects the references into the hover as inline<span>badges. Inscm.cssthe references paragraph is a wrapping flex container, so each badge is a flex item that wraps its text when the name is wider than the hover. The markdown sanitizer only allows color, background,display:inline-block, andborder-radiusin inline styles, so the badge layout has to come fromscm.css.Fix
scmHistory.ts/scm.css: the rendered references section is marked with ahistory-item-hover-referencesclass (instead of being targeted by its position, which missed hovers without a short statistics section, e.g. empty commits). The reference badges in it stay on a single line (white-space: nowrap), are capped at the hover width (max-width: 100%), and long names end with an ellipsis (overflow: hidden; text-overflow: ellipsis). Short names render exactly as before.scmHistory.ts: each badge gets atitlewith the full reference name, so a truncated name can still be read. The name is HTML-attribute encoded, and$is encoded as well so theme-icon rendering (which runs on the rendered HTML string) cannot rewrite$(...)sequences inside the attribute.Validation
pnpm run typecheck-clientpnpm run oxlint src/vs/workbench/contrib/scm/browser/scmHistory.tspnpm run stylelint src/vs/workbench/contrib/scm/browser/media/scm.cssnode build/hygiene.ts src/vs/workbench/contrib/scm/browser/media/scm.css src/vs/workbench/contrib/scm/browser/scmHistory.tspnpm run build-fast+node test/scenario/out/runScenario.js --dev <scenario>(with fix)main, and no badge exposes the full nameThe UI scenario (validate-ui-scenario harness, Code OSS dev build, throwaway profile, scratch repo with a
mainbranch plus a ~120 character branch and tag on the same commit) opens the Graph, hovers the commit, and asserts on the DOM that every reference badge is a single line (same height as themainbadge), fits inside the hover, and has the full reference name as itstitle.Evidence
Before/after screenshots and a side-by-side recording (before on the left, after on the right, labelled) are available; they can be attached to this PR (media can't be uploaded from the CLI).
mainbadge is a 19px pill, but the long branch and tag badges wrap onto two lines and become full-width 38px rounded blocks (the hover is 222px tall).