This commit is contained in:
Unknown 2018-05-21 14:18:50 -07:00
Родитель 8abb23a745
Коммит a24e5e048e
3 изменённых файлов: 31 добавлений и 8 удалений

Просмотреть файл

@ -13,7 +13,7 @@ import * as vscode from 'vscode';
import AbstractProvider from './abstractProvider';
import { DebuggerEventsProtocol } from '../coreclr-debug/debuggerEventsProtocol';
import { OmniSharpServer } from '../omnisharp/server';
import { TestExecutionCountReport, ReportDotnetTestResults, DotnetTestRunStart, DotnetTestMessage, DotnetTestRunFailure, DotnetTestsInClassRunStart } from '../omnisharp/loggingEvents';
import { TestExecutionCountReport, ReportDotnetTestResults, DotnetTestRunStart, DotnetTestMessage, DotnetTestRunFailure, DotnetTestsInClassRunStart, DebuggerWarning, DebugStart, DebugComplete } from '../omnisharp/loggingEvents';
import { EventStream } from '../EventStream';
import LaunchConfiguration from './launchConfiguration';
import Disposable from '../Disposable';
@ -433,19 +433,19 @@ class DebugEventListener {
event = DebuggerEventsProtocol.decodePacket(buffer);
}
catch (e) {
this._outputChannel.appendLine("Warning: Invalid event received from debugger");
this._eventStream.post(new DebuggerWarning("'Invalid' event received from debugger"));
return;
}
switch (event.eventType) {
case DebuggerEventsProtocol.EventType.ProcessLaunched:
let processLaunchedEvent = <DebuggerEventsProtocol.ProcessLaunchedEvent>(event);
this._outputChannel.appendLine(`Started debugging process #${processLaunchedEvent.targetProcessId}.`);
this._eventStream.post(new DebugStart(processLaunchedEvent.targetProcessId));
this.onProcessLaunched(processLaunchedEvent.targetProcessId);
break;
case DebuggerEventsProtocol.EventType.DebuggingStopped:
this._outputChannel.appendLine("Debugging complete.\n");
this._eventStream.post(new DebugComplete());
this.onDebuggingStopped();
break;
}
@ -463,7 +463,7 @@ class DebugEventListener {
if (!isStarted) {
reject(err.message);
} else {
this._outputChannel.appendLine("Warning: Communications error on debugger event channel. " + err.message);
this._eventStream.post(new DebuggerWarning(`Communications error on debugger event channel. ${err.message}`));
}
});
@ -502,7 +502,7 @@ class DebugEventListener {
};
const disposable = this._server.onTestMessage(e => {
this._outputChannel.appendLine(e.Message);
this._eventStream.post(new DotnetTestMessage(e.Message));
});
serverUtils.debugTestLaunch(this._server, request)

Просмотреть файл

@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { BaseEvent, DotnetTestRunStart, DotnetTestMessage, ReportDotnetTestResults, DotnetTestDebugStart } from "../omnisharp/loggingEvents";
import { BaseEvent, DotnetTestRunStart, DotnetTestMessage, ReportDotnetTestResults, DotnetTestDebugStart, DebuggerWarning, DebugStart, DebugComplete } from "../omnisharp/loggingEvents";
import { BaseLoggerObserver } from "./BaseLoggerObserver";
import * as protocol from '../omnisharp/protocol';
@ -23,9 +23,22 @@ export default class DotnetTestLoggerObserver extends BaseLoggerObserver {
case DotnetTestDebugStart.name:
this.handleDotnetTestDebugStart(<DotnetTestDebugStart>event);
break;
case DebuggerWarning.name:
this.handleDebuggerWarning(<DebuggerWarning>event);
break;
case DebugStart.name:
this.handleDebugStart(<DebugStart>event);
break;
case DebugComplete.name:
this.logger.appendLine("Debugging complete.\n");
break;
}
}
private handleDebuggerWarning(event: DebuggerWarning) {
this.logger.appendLine(`Warning: ${event.message}`);
}
private handleDotnetTestDebugStart(event: DotnetTestDebugStart) {
this.logger.appendLine(`Debugging method ${event.testMethod}...`);
this.logger.appendLine('');
@ -36,6 +49,10 @@ export default class DotnetTestLoggerObserver extends BaseLoggerObserver {
this.logger.appendLine('');
}
private handleDebugStart(event: DebugStart) {
this.logger.appendLine(`Started debugging process #${event.targetProcessId}.`);
}
private handleReportDotnetTestResults(event: ReportDotnetTestResults) {
const results = event.results;
const totalTests = results.length;

Просмотреть файл

@ -134,6 +134,10 @@ export class DotnetTestDebugStart implements BaseEvent {
constructor(public testMethod: string) { }
}
export class DebugStart implements BaseEvent {
constructor(public targetProcessId: number) { }
}
export class DebuggerPrerequisiteFailure extends EventWithMessage { }
export class DebuggerPrerequisiteWarning extends EventWithMessage { }
export class CommandDotNetRestoreProgress extends EventWithMessage { }
@ -146,6 +150,7 @@ export class OmnisharpServerMessage extends EventWithMessage { }
export class OmnisharpServerVerboseMessage extends EventWithMessage { }
export class DotnetTestMessage extends EventWithMessage { }
export class DotnetTestRunFailure extends EventWithMessage { }
export class DebuggerWarning extends EventWithMessage { }
export class ProjectModified implements BaseEvent { }
export class ActivationFailure implements BaseEvent { }
@ -162,4 +167,5 @@ export class OmnisharpServerOnStop implements BaseEvent { }
export class OmnisharpServerOnStart implements BaseEvent { }
export class LatestBuildDownloadStart implements BaseEvent { }
export class OmnisharpRestart implements BaseEvent { }
export class DotnetTestsInClassRunStart implements BaseEvent { }
export class DotnetTestsInClassRunStart implements BaseEvent { }
export class DebugComplete implements BaseEvent { }