未验证 提交 1097b5e9 编写于 作者: A Andre Weinand 提交者: GitHub

Merge pull request #57677 from Microsoft/isidorn/onWillNewSession

debugService.onWillNewSession
......@@ -37,11 +37,12 @@ export class MainThreadDebugService implements MainThreadDebugServiceShape, IDeb
this._toDispose = [];
this._toDispose.push(debugService.onDidNewSession(session => {
this._proxy.$acceptDebugSessionStarted(<DebugSessionUUID>session.getId(), session.configuration.type, session.getName(false));
}));
this._toDispose.push(debugService.onWillNewSession(session => {
// Need to start listening early to new session events because a custom event can come while a session is initialising
this._toDispose.push(session.onDidCustomEvent(event => {
if (event && event.sessionId) {
if (process) {
this._proxy.$acceptDebugSessionCustomEvent(event.sessionId, session.configuration.type, session.configuration.name, event);
}
this._proxy.$acceptDebugSessionCustomEvent(event.sessionId, session.configuration.type, session.configuration.name, event);
}
}));
}));
......
......@@ -609,6 +609,11 @@ export interface IDebugService {
*/
onDidNewSession: Event<ISession>;
/**
* Allows to register on sessions about to be created (not yet fully initialised)
*/
onWillNewSession: Event<ISession>;
/**
* Allows to register on end session events.
*/
......
......@@ -65,6 +65,7 @@ export class DebugService implements IDebugService {
private readonly _onDidChangeState: Emitter<State>;
private readonly _onDidNewSession: Emitter<ISession>;
private readonly _onWillNewSession: Emitter<ISession>;
private readonly _onDidEndSession: Emitter<ISession>;
private model: Model;
private viewModel: ViewModel;
......@@ -105,6 +106,7 @@ export class DebugService implements IDebugService {
this.breakpointsToSendOnResourceSaved = new Set<string>();
this._onDidChangeState = new Emitter<State>();
this._onDidNewSession = new Emitter<ISession>();
this._onWillNewSession = new Emitter<ISession>();
this._onDidEndSession = new Emitter<ISession>();
this.configurationManager = this.instantiationService.createInstance(ConfigurationManager);
......@@ -329,6 +331,10 @@ export class DebugService implements IDebugService {
return this._onDidNewSession.event;
}
get onWillNewSession(): Event<ISession> {
return this._onWillNewSession.event;
}
get onDidEndSession(): Event<ISession> {
return this._onDidEndSession.event;
}
......@@ -645,6 +651,7 @@ export class DebugService implements IDebugService {
const dbgr = this.configurationManager.getDebugger(resolved.type);
const session = this.instantiationService.createInstance(Session, sessionId, configuration, root, this.model);
this._onWillNewSession.fire(session);
this.allSessions.set(sessionId, session);
return session.initialize(dbgr).then(() => {
this.registerSessionListeners(session);
......
......@@ -20,6 +20,10 @@ export class MockDebugService implements IDebugService {
return null;
}
public get onWillNewSession(): Event<ISession> {
return null;
}
public get onDidNewSession(): Event<ISession> {
return null;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册