diff --git a/src/vs/workbench/contrib/debug/browser/debugSession.ts b/src/vs/workbench/contrib/debug/browser/debugSession.ts index 56e1714953bb96ebfa81aa68819d7c8d02c63280..8b130dcb54e6db6367599157f0d897c65a5909a4 100644 --- a/src/vs/workbench/contrib/debug/browser/debugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/debugSession.ts @@ -899,7 +899,12 @@ export class DebugSession implements IDebugSession { const promises = this.model.fetchCallStack(thread); const focus = async () => { if (!event.body.preserveFocusHint && thread.getCallStack().length) { - await this.debugService.focusStackFrame(undefined, thread); + const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame; + if (!focusedStackFrame || focusedStackFrame.thread.session === this) { + // Only take focus if nothing is focused, or if the focus is already on the current session + await this.debugService.focusStackFrame(undefined, thread); + } + if (thread.stoppedDetails) { if (thread.stoppedDetails.reason === 'breakpoint' && this.configurationService.getValue('debug').openDebug === 'openOnDebugBreak' && !this.isSimpleUI) { await this.viewletService.openViewlet(VIEWLET_ID);