Skip to content

Conversation

bryanchen-d
Copy link
Contributor

Fixes #152407:

Problem Analysis

The issue occurred when using the debug console picker to switch between consoles. If the selected session was a parent session (wrapper) with child sessions, the console would become unresponsive because it focused the parent session instead of a child that can actually handle evaluation requests.

Root Cause

The existing logic in both repl.ts and debugCommands.ts only looked for stopped child sessions, but ignored running child sessions. When both parent and children were running (not paused), the system would focus the parent session, which couldn't handle REPL evaluations properly.

Solution

@Copilot Copilot AI review requested due to automatic review settings October 9, 2025 00:49
@bryanchen-d bryanchen-d self-assigned this Oct 9, 2025
@bryanchen-d bryanchen-d requested review from roblourens and removed request for Copilot October 9, 2025 00:49
@bryanchen-d bryanchen-d added this to the October 2025 milestone Oct 9, 2025
@bryanchen-d bryanchen-d added debug Debug viewlet, configurations, breakpoints, adapter issues debug-console labels Oct 9, 2025
@bryanchen-d bryanchen-d requested a review from Copilot October 9, 2025 05:04
Copy link
Contributor

@Copilot 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

This PR fixes a bug where the debug console becomes unresponsive when switching between debug sessions. The issue occurred when the debug console picker selected a parent session (wrapper) that couldn't handle REPL evaluations, instead of selecting a child session that could actually process evaluation requests.

  • Introduces a centralized resolveChildSession utility function in debugUtils.ts
  • Refactors existing logic in repl.ts and debugCommands.ts to use the new utility
  • Improves session selection to prefer child sessions over parent wrapper sessions

Reviewed Changes

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

File Description
src/vs/workbench/contrib/debug/common/debugUtils.ts Adds new resolveChildSession utility function with proper logic to select the best child session
src/vs/workbench/contrib/debug/browser/repl.ts Replaces inline session resolution logic with call to the new utility function
src/vs/workbench/contrib/debug/browser/debugCommands.ts Replaces inline session resolution logic with call to the new utility function

Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

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

This looks good but I will test it a bit later

if (stoppedChildSession && session.state !== State.Stopped) {
session = stoppedChildSession;
}
session = resolveChildSession(session, debugService.getModel().getSessions());
Copy link
Member

Choose a reason for hiding this comment

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

What's the difference between this command and the one in repl.ts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debug Debug viewlet, configurations, breakpoints, adapter issues debug-console

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Using debug console picker when not paused leaves console unresponsive

2 participants