提交 efbc898d 编写于 作者: I isidor

Debug events: sessionId should live one level up from the body

fixes #31391
上级 064efc97
......@@ -34,9 +34,9 @@ export class MainThreadDebugService extends MainThreadDebugServiceShape {
}
}));
this._toDispose.push(debugService.onDidCustomEvent(event => {
if (event.body && event.body.sessionId) {
const process = this.debugService.findProcessByUUID(event.body.sessionId); // TODO
this._proxy.$acceptDebugSessionCustomEvent(event.body.sessionId, process.configuration.type, process.configuration.name, event);
if (event && event.sessionId) {
const process = this.debugService.findProcessByUUID(event.sessionId);
this._proxy.$acceptDebugSessionCustomEvent(event.sessionId, process.configuration.type, process.configuration.name, event);
}
}));
}
......
......@@ -451,6 +451,10 @@ export interface ILaunch {
export const IDebugService = createDecorator<IDebugService>(DEBUG_SERVICE_ID);
export interface DebugEvent extends DebugProtocol.Event {
sessionId?: string;
}
export interface IDebugService {
_serviceBrand: any;
......@@ -477,7 +481,7 @@ export interface IDebugService {
/**
* Allows to register on custom DAP events.
*/
onDidCustomEvent: Event<DebugProtocol.Event>;
onDidCustomEvent: Event<DebugEvent>;
/**
* Gets the current configuration manager.
......
......@@ -69,7 +69,7 @@ export class DebugService implements debug.IDebugService {
private _onDidChangeState: Emitter<debug.State>;
private _onDidNewProcess: Emitter<debug.IProcess>;
private _onDidEndProcess: Emitter<debug.IProcess>;
private _onDidCustomEvent: Emitter<DebugProtocol.Event>;
private _onDidCustomEvent: Emitter<debug.DebugEvent>;
private model: Model;
private viewModel: ViewModel;
private allSessionIds: Set<string>;
......@@ -114,7 +114,7 @@ export class DebugService implements debug.IDebugService {
this._onDidChangeState = new Emitter<debug.State>();
this._onDidNewProcess = new Emitter<debug.IProcess>();
this._onDidEndProcess = new Emitter<debug.IProcess>();
this._onDidCustomEvent = new Emitter<DebugProtocol.Event>();
this._onDidCustomEvent = new Emitter<debug.DebugEvent>();
this.sessionStates = new Map<string, debug.State>();
this.allSessionIds = new Set<string>();
......@@ -346,7 +346,7 @@ export class DebugService implements debug.IDebugService {
this.toDisposeOnSessionEnd.get(session.getId()).push(session.onDidTerminateDebugee(event => {
aria.status(nls.localize('debuggingStopped', "Debugging stopped."));
if (session && session.getId() === event.body.sessionId) {
if (session && session.getId() === event.sessionId) {
if (event.body && event.body.restart && process) {
this.restartProcess(process, event.body.restart).done(null, err => this.messageService.show(severity.Error, err.message));
} else {
......@@ -416,7 +416,7 @@ export class DebugService implements debug.IDebugService {
payload: [process.session.root.fsPath]
});
}
if (session && session.getId() === event.body.sessionId) {
if (session && session.getId() === event.sessionId) {
this.onSessionEnd(session);
}
}));
......@@ -511,7 +511,7 @@ export class DebugService implements debug.IDebugService {
return this._onDidEndProcess.event;
}
public get onDidCustomEvent(): Event<DebugProtocol.Event> {
public get onDidCustomEvent(): Event<debug.DebugEvent> {
return this._onDidCustomEvent.event;
}
......
......@@ -21,27 +21,27 @@ import { ITerminalService } from 'vs/workbench/parts/terminal/common/terminal';
import { ITerminalService as IExternalTerminalService } from 'vs/workbench/parts/execution/common/execution';
import debug = require('vs/workbench/parts/debug/common/debug');
import { Adapter } from 'vs/workbench/parts/debug/node/debugAdapter';
import v8 = require('vs/workbench/parts/debug/node/v8Protocol');
import { V8Protocol } from 'vs/workbench/parts/debug/node/v8Protocol';
import { IOutputService } from 'vs/workbench/parts/output/common/output';
import { ExtensionsChannelId } from 'vs/platform/extensionManagement/common/extensionManagement';
import { TerminalSupport } from 'vs/workbench/parts/debug/electron-browser/terminalSupport';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
export interface SessionExitedEvent extends DebugProtocol.ExitedEvent {
export interface SessionExitedEvent extends debug.DebugEvent {
body: {
exitCode: number,
sessionId: string
};
}
export interface SessionTerminatedEvent extends DebugProtocol.TerminatedEvent {
export interface SessionTerminatedEvent extends debug.DebugEvent {
body: {
restart?: boolean,
sessionId: string
};
}
export class RawDebugSession extends v8.V8Protocol implements debug.ISession {
export class RawDebugSession extends V8Protocol implements debug.ISession {
public emittedStopped: boolean;
public readyForBreakpoints: boolean;
......@@ -63,7 +63,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession {
private _onDidThread: Emitter<DebugProtocol.ThreadEvent>;
private _onDidOutput: Emitter<DebugProtocol.OutputEvent>;
private _onDidBreakpoint: Emitter<DebugProtocol.BreakpointEvent>;
private _onDidCustomEvent: Emitter<DebugProtocol.Event>;
private _onDidCustomEvent: Emitter<debug.DebugEvent>;
private _onDidEvent: Emitter<DebugProtocol.Event>;
constructor(
......@@ -93,7 +93,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession {
this._onDidThread = new Emitter<DebugProtocol.ThreadEvent>();
this._onDidOutput = new Emitter<DebugProtocol.OutputEvent>();
this._onDidBreakpoint = new Emitter<DebugProtocol.BreakpointEvent>();
this._onDidCustomEvent = new Emitter<DebugProtocol.Event>();
this._onDidCustomEvent = new Emitter<debug.DebugEvent>();
this._onDidEvent = new Emitter<DebugProtocol.Event>();
}
......@@ -129,7 +129,7 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession {
return this._onDidBreakpoint.event;
}
public get onDidCustomEvent(): Event<DebugProtocol.Event> {
public get onDidCustomEvent(): Event<debug.DebugEvent> {
return this._onDidCustomEvent.event;
}
......@@ -191,12 +191,8 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession {
});
}
protected onEvent(event: DebugProtocol.Event): void {
if (event.body) {
event.body.sessionId = this.getId();
} else {
event.body = { sessionId: this.getId() };
}
protected onEvent(event: debug.DebugEvent): void {
event.sessionId = this.getId();
if (event.event === 'initialized') {
this.readyForBreakpoints = true;
......
......@@ -15,7 +15,7 @@ export class MockDebugService implements debug.IDebugService {
return null;
}
public get onDidCustomEvent(): Event<DebugProtocol.Event> {
public get onDidCustomEvent(): Event<debug.DebugEvent> {
return null;
}
......@@ -172,7 +172,7 @@ export class MockSession implements debug.ISession {
return {};
}
public get onDidEvent(): Event<DebugProtocol.Event> {
public get onDidEvent(): Event<debug.DebugEvent> {
return null;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册