Skip to content

Persist active tab state in diagnostic view#164

Merged
rajbos merged 6 commits intomainfrom
copilot/fix-diagnostic-view-tab
Jan 31, 2026
Merged

Persist active tab state in diagnostic view#164
rajbos merged 6 commits intomainfrom
copilot/fix-diagnostic-view-tab

Conversation

Copy link
Contributor

Copilot AI commented Jan 30, 2026

Diagnostic view resets to the first tab on every navigation, forcing users to re-select their tab and causing unnecessary reloads of the Session Files content.

Changes

  • State management: Use VS Code webview state API to persist activeTab across view lifecycle
  • Tab activation: Extract tab switching logic into activateTab(tabId) helper that returns success/failure
  • Restoration: On render, restore saved tab with fallback to default if tab doesn't exist

Implementation

// Save on tab click
vscode.setState({ activeTab: tabId });

// Restore on view load
const savedState = vscode.getState();
if (savedState?.activeTab && !activateTab(savedState.activeTab)) {
    activateTab('report');  // fallback
}

State persists even with retainContextWhenHidden: false since it uses the webview state API rather than in-memory storage.

Original prompt

Every time we go back to the diagnostic view it starts on the first tab instead of staying open on the last opened tab.

That means also that the files sub tab is reloaded as well, instead of just shown!


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 30, 2026 19:58
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix diagnostic view to retain last opened tab Persist active tab state in diagnostic view Jan 30, 2026
@rajbos rajbos marked this pull request as ready for review January 31, 2026 19:57
@rajbos rajbos enabled auto-merge January 31, 2026 20:11
@rajbos rajbos merged commit 3062b5b into main Jan 31, 2026
17 checks passed
@rajbos rajbos deleted the copilot/fix-diagnostic-view-tab branch January 31, 2026 20:13
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.

2 participants

Comments