Skip to content

Commit a9288be

Browse files
committed
Focus the editor on debug stop, by default. Fix #139950
1 parent 49d2821 commit a9288be

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/vs/workbench/contrib/debug/browser/debug.contribution.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,11 @@ configurationRegistry.registerConfiguration({
511511
description: nls.localize('debug.focusWindowOnBreak', "Controls whether the workbench window should be focused when the debugger breaks."),
512512
default: true
513513
},
514+
'debug.focusEditorOnBreak': {
515+
type: 'boolean',
516+
description: nls.localize('debug.focusEditorOnBreak', "Controls whether the editor should be focused when the debugger breaks."),
517+
default: true
518+
},
514519
'debug.onTaskErrors': {
515520
enum: ['debugAnyway', 'showErrors', 'prompt', 'abort'],
516521
enumDescriptions: [nls.localize('debugAnyway', "Ignore task errors and start debugging."), nls.localize('showErrors', "Show the Problems view and do not start debugging."), nls.localize('prompt', "Prompt user."), nls.localize('cancel', "Cancel debugging.")],

src/vs/workbench/contrib/debug/browser/debugSession.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,8 @@ export class DebugSession implements IDebugSession {
958958
const focusedStackFrame = this.debugService.getViewModel().focusedStackFrame;
959959
if (!focusedStackFrame || focusedStackFrame.thread.session === this) {
960960
// Only take focus if nothing is focused, or if the focus is already on the current session
961-
await this.debugService.focusStackFrame(undefined, thread);
961+
const preserveFocus = !this.configurationService.getValue<IDebugConfiguration>('debug').focusEditorOnBreak;
962+
await this.debugService.focusStackFrame(undefined, thread, undefined, { preserveFocus });
962963
}
963964

964965
if (thread.stoppedDetails) {

src/vs/workbench/contrib/debug/common/debug.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@ export interface IDebugConfiguration {
630630
acceptSuggestionOnEnter: 'off' | 'on';
631631
};
632632
focusWindowOnBreak: boolean;
633+
focusEditorOnBreak: boolean;
633634
onTaskErrors: 'debugAnyway' | 'showErrors' | 'prompt' | 'abort';
634635
showBreakpointsInOverviewRuler: boolean;
635636
showInlineBreakpointCandidates: boolean;

0 commit comments

Comments
 (0)