diff --git a/src/vs/workbench/contrib/debug/browser/debugSession.ts b/src/vs/workbench/contrib/debug/browser/debugSession.ts index 4c6c45aa7a60f..554314b656fcb 100644 --- a/src/vs/workbench/contrib/debug/browser/debugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/debugSession.ts @@ -139,12 +139,13 @@ export class DebugSession implements IDebugSession { const parent = this._options.parentSession; if (parent) { toDispose.add(parent.onDidEndAdapter(() => { - // copy the parent repl and get a new detached repl for this child - if (!this.hasSeparateRepl()) { + // copy the parent repl and get a new detached repl for this child, and + // remove its parent, if it's still running + if (!this.hasSeparateRepl() && this.raw?.isInShutdown === false) { this.repl = this.repl.clone(); replListener.value = this.repl.onDidChangeElements(() => this._onDidChangeREPLElements.fire()); + this.parentSession = undefined; } - this.parentSession = undefined; })); } } diff --git a/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts b/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts index c9d1d4d972a36..e9db37e6855d9 100644 --- a/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/rawDebugSession.ts @@ -172,6 +172,10 @@ export class RawDebugSession implements IDisposable { this.debugAdapter.onRequest(request => this.dispatchRequest(request)); } + get isInShutdown() { + return this.inShutdown; + } + get onDidExitAdapter(): Event { return this._onDidExitAdapter.event; }