Skip to content

Adjusts Commit Graph columns for narrow layouts#5501

Closed
sergeibbb wants to merge 2 commits into
mainfrom
feature/5391-graph-columns-adjustment
Closed

Adjusts Commit Graph columns for narrow layouts#5501
sergeibbb wants to merge 2 commits into
mainfrom
feature/5391-graph-columns-adjustment

Conversation

@sergeibbb

Copy link
Copy Markdown
Member

Summary

Adjusts the Commit Graph's columns when the graph view is horizontally narrow: uses a compact graph column and hides the SHA and Changes columns so the limited horizontal space is used effectively. Closes #5500 (sub-issue of #5391).

The trigger is the graph's actual width, not where the details panel is pinned — so an explicit details-on-bottom pin on a wide editor is not treated as narrow, and a genuinely narrow graph gets the treatment regardless of the pin. Reuses the same width breakpoint (with hysteresis) already used for the auto details-location decision.

Behavior

  • Narrow: graph column → compact mode, SHA and Changes columns hidden.
  • Wide: columns render from the user's stored settings, unchanged.
  • Not persisted: resizing/reordering a column while narrow strips the compact/hidden overrides before saving, so the user's wide-view preferences survive.
  • Reactive: width changes apply/remove the overrides immediately, no reload.
  • Column menus while narrow: the managed toggles (Show/Hide SHA, Show/Hide Changes, Compact/Expanded Graph Column) are disabled in the column header / settings-gear context menus, and reflect the effective (overridden) state rather than the stored one. A disabled info line — "Some Options Return When the Graph Is Wider" — explains why (VS Code menus don't support tooltips, so a disabled info item is the conventional substitute). Unmanaged toggles (author, date, message, ref) stay fully functional.

Implementation

  • src/webviews/apps/plus/graph/graph-app.tsisGraphViewNarrow getter, keyed off the width-driven _autoEffectiveLocation signal (decoupled from the details-panel pin); passed to the wrapper.
  • src/webviews/apps/plus/graph/graph-wrapper/graph-wrapper.ts:
    • effectiveColumns — applies the narrow overrides, identity-cached to avoid prop churn on unrelated renders.
    • onColumnsChanged — strips the overrides before persisting.
    • effectiveGraphContext — rewrites the column-menu context tokens to the effective state and appends a columns:narrow token; identity-cached (the React engine ingests context by reference).
  • contributions.jsonenablement guards on the six managed column commands (keyed off columns:narrow) + a new disabled gitlens.graph.columnsNarrowInfo info-line command.
  • package.json / src/constants.commands.generated.ts — regenerated from contributions.json.
  • CHANGELOG.md — entry under Changed.

Test plan

Verified live via the vscode-inspector MCP, both engines (React and Lit):

  • Narrow graph view (792px): graph column compact, SHA + Changes headers hidden, columns not persisted after resize, data-vscode-context carries columns:narrow + rewritten tokens.
  • Wide graph page (1152px+): no overrides, no columns:narrow token, stored settings unaffected.
  • Switching width reactively applies/removes overrides without a reload.
  • pnpm run build (type-check + unit-test compile) passes clean.
  • Manual: right-click the column header while narrow — confirm the managed items render grayed out and the info line appears (native VS Code context menu, not verifiable via DOM automation).

🤖 Generated with Claude Code

sergeibbb and others added 2 commits July 14, 2026 17:50
Automatically adjusts column visibility and mode when the graph view is horizontally constrained.

Hides SHA and Changes columns, and sets the Graph column to compact mode to improve space utilization. Related column commands in context menus are disabled, and an informational message is displayed to explain the automatic adjustments.

Ensures these layout-driven overrides are not persisted as user preferences, preserving custom column settings for wider graph views.

(#5500, #5391)
(#5500, #5391)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sergeibbb sergeibbb closed this Jul 14, 2026
@sergeibbb

Copy link
Copy Markdown
Member Author

Closing since it's already implemented in the new Graph engine

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.

Graph vertical layout: use compact graph column and hide SHA column

1 participant