From 9825637f067c3e3d49cc704ea3425ce41bb7bb34 Mon Sep 17 00:00:00 2001 From: isidor Date: Mon, 16 Jul 2018 15:25:00 +0200 Subject: [PATCH] debug: simplify reacting to exit events --- .../parts/debug/electron-browser/debugService.ts | 10 ++++------ .../parts/debug/electron-browser/rawDebugSession.ts | 6 +----- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index 47d955d0054..1ce303a20a4 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -167,7 +167,7 @@ export class DebugService implements debug.IDebugService { (session.raw).attach(session.configuration); }); } else { - this.onRawSessionEnd(raw); + raw.disconnect().done(undefined, errors.onUnexpectedError); this.doCreateSession(session.raw.root, { resolved: session.configuration, unresolved: session.unresolvedConfiguration }, session.getId()); } @@ -175,7 +175,7 @@ export class DebugService implements debug.IDebugService { } if (broadcast.channel === EXTENSION_TERMINATE_BROADCAST_CHANNEL) { - this.onRawSessionEnd(raw); + raw.disconnect().done(undefined, errors.onUnexpectedError); return; } @@ -285,8 +285,6 @@ export class DebugService implements debug.IDebugService { } private registerSessionListeners(session: debug.ISession, raw: RawDebugSession): void { - this.toDisposeOnSessionEnd.get(raw.getId()).push(raw); - this.toDisposeOnSessionEnd.get(raw.getId()).push(raw.onDidInitialize(event => { aria.status(nls.localize('debuggingStarted', "Debugging started.")); const sendConfigurationDone = () => { @@ -447,7 +445,7 @@ export class DebugService implements debug.IDebugService { }); } if (session && session.getId() === event.sessionId) { - this.onRawSessionEnd(raw); + this.onExitAdapter(raw); } })); @@ -1172,7 +1170,7 @@ export class DebugService implements debug.IDebugService { return undefined; } - private onRawSessionEnd(raw: RawDebugSession): void { + private onExitAdapter(raw: RawDebugSession): void { const breakpoints = this.model.getBreakpoints(); const session = this.model.getSessions().filter(p => p.getId() === raw.getId()).pop(); /* __GDPR__ diff --git a/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts b/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts index 73740d649f3..e9738e46c9a 100644 --- a/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts +++ b/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts @@ -354,7 +354,7 @@ export class RawDebugSession implements debug.IRawSession { if (this.debugAdapter && !this.disconnected) { // point of no return: from now on don't report any errors this.disconnected = true; - return this.send('disconnect', { restart: restart }, false).then(() => this.stopServer(), () => this.stopServer()); + return this.send('disconnect', { restart }, false).then(() => this.stopServer(), () => this.stopServer()); } return TPromise.as(null); @@ -513,8 +513,4 @@ export class RawDebugSession implements debug.IRawSession { } this._onDidExitAdapter.fire({ sessionId: this.getId() }); } - - public dispose(): void { - this.disconnect().done(null, errors.onUnexpectedError); - } } -- GitLab