Repository navigation
debug: decouple ViewModel from IDebugModel - #340770
Merged
Connor Peet (connor4312) merged 1 commit intoOct 9, 2026
Merged
Conversation
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]>
Contributor
There was a problem hiding this comment.
🟡 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(); |
Contributor
Dmitriy Vasyura (dmitrivMS)
approved these changes
Oct 9, 2026
Connor Peet (connor4312)
deleted the
connor4312/debug-viewmodel-stack-context
branch
October 9, 2026 20:32
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.

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 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.