Skip to content

Commit

Permalink
fixes #128400
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Jul 29, 2021
1 parent 263c781 commit a17bb40
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/vs/workbench/contrib/debug/browser/debugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -951,18 +951,20 @@ export class DebugSession implements IDebugSession {

this.model.clearThreads(this.getId(), false, threadId);
this._onDidChangeState.fire();
// If the focused thread does get stopped in the next 800ms auto focus another thread or session https://github.com/microsoft/vscode/issues/125144
if (typeof threadId === 'number') {
const thread = this.debugService.getViewModel().focusedThread;
if (thread && thread.threadId === threadId && !thread.stopped) {
const toFocusThreadId = this.getStoppedDetails()?.threadId;
const toFocusThread = typeof toFocusThreadId === 'number' ? this.getThread(toFocusThreadId) : undefined;
this.debugService.focusStackFrame(undefined, toFocusThread);
}
} else {
const session = this.debugService.getViewModel().focusedSession;
if (session && session.getId() === this.getId() && session.state !== State.Stopped) {
this.debugService.focusStackFrame(undefined);
// If there is some session or thread that is stopped pass focus to it
if (this.debugService.getModel().getSessions().some(s => s.state === State.Stopped) || this.getAllThreads().some(t => t.stopped)) {
if (typeof threadId === 'number') {
const thread = this.debugService.getViewModel().focusedThread;
if (thread && thread.threadId === threadId && !thread.stopped) {
const toFocusThreadId = this.getStoppedDetails()?.threadId;
const toFocusThread = typeof toFocusThreadId === 'number' ? this.getThread(toFocusThreadId) : undefined;
this.debugService.focusStackFrame(undefined, toFocusThread);
}
} else {
const session = this.debugService.getViewModel().focusedSession;
if (session && session.getId() === this.getId() && session.state !== State.Stopped) {
this.debugService.focusStackFrame(undefined);
}
}
}
}));
Expand Down

0 comments on commit a17bb40

Please sign in to comment.