final tracker API; for #62843

This commit is contained in:
Andre Weinand
2018-11-30 15:16:57 +01:00
parent 72812c4157
commit f168d88224
2 changed files with 54 additions and 27 deletions

View File

@@ -420,7 +420,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
da.onMessage(message => {
if (tracker) {
tracker.fromDebugAdapter(message);
tracker.onDidSendMessage(message);
}
// DA -> VS Code
@@ -430,19 +430,19 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
});
da.onError(err => {
if (tracker) {
tracker.debugAdapterError(err);
tracker.onError(err);
}
this._debugServiceProxy.$acceptDAError(debugAdapterHandle, err.name, err.message, err.stack);
});
da.onExit(code => {
if (tracker) {
tracker.debugAdapterExit(code, null);
tracker.onExit(code, undefined);
}
this._debugServiceProxy.$acceptDAExit(debugAdapterHandle, code, null);
});
if (tracker) {
tracker.startDebugAdapter();
tracker.onWillStartSession();
}
return da.startSession();
@@ -460,7 +460,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
const tracker = this._debugAdaptersTrackers.get(debugAdapterHandle); // TODO@AW: same handle?
if (tracker) {
tracker.toDebugAdapter(message);
tracker.onWillReceiveMessage(message);
}
const da = this._debugAdapters.get(debugAdapterHandle);
@@ -475,7 +475,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
const tracker = this._debugAdaptersTrackers.get(debugAdapterHandle);
this._debugAdaptersTrackers.delete(debugAdapterHandle);
if (tracker) {
tracker.stopDebugAdapter();
tracker.onWillStopSession();
}
const da = this._debugAdapters.get(debugAdapterHandle);
@@ -929,28 +929,28 @@ class MultiTracker implements vscode.DebugAdapterTracker {
constructor(private trackers: vscode.DebugAdapterTracker[]) {
}
startDebugAdapter(): void {
this.trackers.forEach(t => t.startDebugAdapter ? t.startDebugAdapter() : void 0);
onWillStartSession(): void {
this.trackers.forEach(t => t.onWillStartSession ? t.onWillStartSession() : (t.startDebugAdapter ? t.startDebugAdapter() : void 0));
}
toDebugAdapter(message: any): void {
this.trackers.forEach(t => t.toDebugAdapter ? t.toDebugAdapter(message) : void 0);
onWillReceiveMessage(message: any): void {
this.trackers.forEach(t => t.onWillReceiveMessage ? t.onWillReceiveMessage(message) : (t.toDebugAdapter ? t.toDebugAdapter(message) : void 0));
}
fromDebugAdapter(message: any): void {
this.trackers.forEach(t => t.fromDebugAdapter ? t.fromDebugAdapter(message) : void 0);
onDidSendMessage(message: any): void {
this.trackers.forEach(t => t.onDidSendMessage ? t.onDidSendMessage(message) : (t.fromDebugAdapter ? t.fromDebugAdapter(message) : void 0));
}
debugAdapterError(error: Error): void {
this.trackers.forEach(t => t.debugAdapterError ? t.debugAdapterError(error) : void 0);
onWillStopSession(): void {
this.trackers.forEach(t => t.onWillStopSession ? t.onWillStopSession() : (t.stopDebugAdapter ? t.stopDebugAdapter() : void 0));
}
debugAdapterExit(code: number, signal: string): void {
this.trackers.forEach(t => t.debugAdapterExit ? t.debugAdapterExit(code, signal) : void 0);
onError(error: Error): void {
this.trackers.forEach(t => t.onError ? t.onError(error) : (t.debugAdapterError ? t.debugAdapterError(error) : void 0));
}
stopDebugAdapter(): void {
this.trackers.forEach(t => t.stopDebugAdapter ? t.stopDebugAdapter() : void 0);
onExit(code: number, signal: string): void {
this.trackers.forEach(t => t.onExit ? t.onExit(code, signal) : (t.debugAdapterExit ? t.debugAdapterExit(code, signal) : void 0));
}
}