Focus the editor on debug stop, by default. Fix #139950

This commit is contained in:
Rob Lourens
2022-04-14 17:41:16 -07:00
parent 49d2821d44
commit a9288be67b
3 changed files with 8 additions and 1 deletions
@@ -511,6 +511,11 @@ configurationRegistry.registerConfiguration({
description: nls.localize('debug.focusWindowOnBreak', "Controls whether the workbench window should be focused when the debugger breaks."),
default: true
},
'debug.focusEditorOnBreak': {
type: 'boolean',
description: nls.localize('debug.focusEditorOnBreak', "Controls whether the editor should be focused when the debugger breaks."),
default: true
},
'debug.onTaskErrors': {
enum: ['debugAnyway', 'showErrors', 'prompt', 'abort'],
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.")],
@@ -958,7 +958,8 @@ export class DebugSession implements IDebugSession {
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);
const preserveFocus = !this.configurationService.getValue<IDebugConfiguration>('debug').focusEditorOnBreak;
await this.debugService.focusStackFrame(undefined, thread, undefined, { preserveFocus });
}
if (thread.stoppedDetails) {
@@ -630,6 +630,7 @@ export interface IDebugConfiguration {
acceptSuggestionOnEnter: 'off' | 'on';
};
focusWindowOnBreak: boolean;
focusEditorOnBreak: boolean;
onTaskErrors: 'debugAnyway' | 'showErrors' | 'prompt' | 'abort';
showBreakpointsInOverviewRuler: boolean;
showInlineBreakpointCandidates: boolean;