debug: do not focus new session automatically

fixes #79121
This commit is contained in:
isidor 2019-08-21 12:14:32 +02:00
parent b8ec1d7733
commit 38aa476610
2 changed files with 4 additions and 3 deletions

View file

@ -479,11 +479,11 @@ export class DebugService implements IDebugService {
});
}
private launchOrAttachToSession(session: IDebugSession, focus = true): Promise<void> {
private launchOrAttachToSession(session: IDebugSession, forceFocus = false): Promise<void> {
const dbgr = this.configurationManager.getDebugger(session.configuration.type);
return session.initialize(dbgr!).then(() => {
return session.launchOrAttach(session.configuration).then(() => {
if (focus) {
if (forceFocus || !this.viewModel.focusedSession) {
this.focusStackFrame(undefined, undefined, session);
}
});
@ -572,7 +572,7 @@ export class DebugService implements IDebugService {
return runTasks().then(taskResult => taskResult === TaskRunResult.Success ? this.extensionHostDebugService.reload(session.getId()) : undefined);
}
const shouldFocus = this.viewModel.focusedSession && session.getId() === this.viewModel.focusedSession.getId();
const shouldFocus = !!this.viewModel.focusedSession && session.getId() === this.viewModel.focusedSession.getId();
// If the restart is automatic -> disconnect, otherwise -> terminate #55064
return (isAutoRestart ? session.disconnect(true) : session.terminate(true)).then(() => {

View file

@ -131,6 +131,7 @@ export class DebugToolBar extends Themable implements IWorkbenchContribution {
private registerListeners(): void {
this._register(this.debugService.onDidChangeState(() => this.updateScheduler.schedule()));
this._register(this.debugService.getViewModel().onDidFocusSession(() => this.updateScheduler.schedule()));
this._register(this.debugService.onDidNewSession(() => this.updateScheduler.schedule()));
this._register(this.configurationService.onDidChangeConfiguration(e => this.onDidConfigurationChange(e)));
this._register(this.actionBar.actionRunner.onDidRun((e: IRunEvent) => {
// check for error