Skip to content

Sessions: Replace badge with inline title count in Changes view#303482

Merged
mrleemurray merged 6 commits intomainfrom
mrleemurray/changes-view-inline-count
Mar 20, 2026
Merged

Sessions: Replace badge with inline title count in Changes view#303482
mrleemurray merged 6 commits intomainfrom
mrleemurray/changes-view-inline-count

Conversation

@mrleemurray
Copy link
Contributor

Update the Changes view to display an inline title count instead of a badge, ensuring accurate file counts by utilizing top-level statistics. Maintain the count when switching tabs and address review feedback for improved clarity and functionality.

Replace the NumberBadge on the Changes view tab with an inline title
that shows the file count directly, e.g. '7 Changes' instead of a
badge overlay.

- Export dynamic changesContainerTitle with a getter-based value
- Add refreshContainerInfo() to IViewContainerModel interface and
  ViewContainerModel implementation
- Remove IActivityService/NumberBadge dependency from ChangesViewPane
The inline title count was reading from activeSessionChangesObs (raw
session changes only) instead of topLevelStats which accounts for
deduplication and version mode filtering. Move the title update into
onVisible() where topLevelStats is available, and reset the title
when the view is hidden.
- Add blank line separator after changesContainerTitle block
- Add constructor-level fallback autorun to keep title in sync when
  the view is hidden and the active session changes
- Reset title to 'Changes' on dispose to avoid stale counts
Remove the updateContainerTitle(0) call from the hide handler so
the count persists when the user switches to another tab. The
fallback autorun in the constructor still handles session switches
while the view is hidden.
Copilot AI review requested due to automatic review settings March 20, 2026 12:08
@mrleemurray mrleemurray enabled auto-merge (squash) March 20, 2026 12:08
@mrleemurray mrleemurray self-assigned this Mar 20, 2026
@vs-code-engineering vs-code-engineering bot added this to the 1.113.0 milestone Mar 20, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Sessions “Changes” view container to show the file count inline in the tab title (instead of a badge), and introduces a small API to force re-reading container metadata when the title changes dynamically.

Changes:

  • Add refreshContainerInfo() to IViewContainerModel / ViewContainerModel so callers can trigger a re-read of container title/icon/keybinding.
  • Implement a dynamic ILocalizedString title for the Changes view container and update it from computed top-level stats while the view is visible.
  • Update the Changes view container registration to use the dynamic title object.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/vs/workbench/services/views/common/viewContainerModel.ts Adds refreshContainerInfo() to re-run container metadata computation and emit change events.
src/vs/workbench/common/views.ts Extends IViewContainerModel with the new refreshContainerInfo() API and documentation.
src/vs/sessions/contrib/changes/browser/changesView.ts Replaces the activity badge approach with dynamic container title updates driven by topLevelStats.
src/vs/sessions/contrib/changes/browser/changesView.contribution.ts Registers the Changes container using the new dynamic changesContainerTitle.

@vs-code-engineering
Copy link
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/workbench/common/views.ts
  • src/vs/workbench/services/views/common/viewContainerModel.ts

@sandy081

Matched files:

  • src/vs/workbench/services/views/common/viewContainerModel.ts

@benibenj

Matched files:

  • src/vs/workbench/services/views/common/viewContainerModel.ts

@mrleemurray mrleemurray merged commit 69ca0c3 into main Mar 20, 2026
29 of 30 checks passed
@mrleemurray mrleemurray deleted the mrleemurray/changes-view-inline-count branch March 20, 2026 20:04
lszomoru added a commit that referenced this pull request Mar 23, 2026
lszomoru added a commit that referenced this pull request Mar 23, 2026
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.

3 participants