Skip to content

debug: decouple ViewModel from IDebugModel - #340770

Merged
Connor Peet (connor4312) merged 1 commit into
mainfrom
connor4312/debug-viewmodel-stack-context
Oct 9, 2026
Merged

Connor Peet (connor4312) merged 1 commit into
mainfrom
connor4312/debug-viewmodel-stack-context

Conversation

@connor4312

Copy link
Copy Markdown
Member

Follow-up to #336125; related to #336124.

Keep the Step Out stack-depth context in the ViewModel, but have DebugService refresh it from its existing model call-stack listener. This removes the optional IDebugModel constructor dependency and the per-focus event subscription from the ViewModel without expanding IViewModel.

Focus changes still refresh the context immediately. Delayed stack loading and completion continue to refresh it even when focus does not change. The shared stack-depth predicate, item-specific menu overlays, and completion notifications are unchanged.

Adds regression tests for same-focus stack-depth updates without focus events, completion of an unknown one-frame stack, switching threads, and clearing focus.

Validation

All commands below passed using Node 24.18.0:

  • fnm exec --using 24.18.0 npm run build-fast -- --client-only — passed.
  • fnm exec --using 24.18.0 npm run eslint -- src/vs/workbench/contrib/debug/common/debugViewModel.ts src/vs/workbench/contrib/debug/browser/debugService.ts src/vs/workbench/contrib/debug/test/browser/debugViewModel.test.ts — passed.
  • fnm exec --using 24.18.0 ./scripts/test.sh --reporter dot --run src/vs/workbench/contrib/debug/test/browser/debugViewModel.test.ts --run src/vs/workbench/contrib/debug/test/browser/callStack.test.ts --run src/vs/workbench/contrib/debug/test/common/debugModel.test.ts — 27 tests passed.
  • git diff --check — passed.
  • The commit's pre-commit hygiene hook — passed for all three changed files.

The fast build transpiles rather than type-checks. Full type-check, integration/smoke suites, and live debugger flows were not run; this is a narrow dependency-wiring refactor with no intended UI behavior change.

Let DebugService refresh the focused thread's stack-depth context from its existing call-stack listener. Keep context-key ownership in the ViewModel without passing it the full debug model or resubscribing on focus changes.

Follow-up to #336125.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 9, 2026 17:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The regression tests bypass the new production event wiring, leaving its essential behavior uncovered.

1 open finding
What changed in this PR

Decouples the debug ViewModel from IDebugModel while preserving Step Out stack-depth updates.

Changes:

  • Moves call-stack refresh wiring into DebugService.
  • Adds focused-thread stack-depth refresh API.
  • Adds stack-depth state tests.
File Description
debugService.ts Refreshes ViewModel state on call-stack changes.
debugViewModel.ts Removes model dependency and exposes refresh method.
debugViewModel.test.ts Tests stack-depth and focus transitions.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

this.debugStorage.storeDebugUxState(debugUxValue);
}));
this.disposables.add(this.model.onDidChangeCallStack(() => {
this.viewModel.updateFocusedThreadHasMultipleStackFrames();
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: f6a70e2a Current: 6f5e2bc1

Changed (2)

sessions/chatCompositeBar/MixedStatuses/Light
Before After
before after
sessions/chatCompositeBar/OverflowingTabs/Light
Before After
before after

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