Reveal the error location after on failed verify.

Closes #608
Closes #229

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
Akos Kitta
2022-06-08 11:29:18 +02:00
committed by Akos Kitta
parent a715da3d18
commit d6f4096cd0
23 changed files with 1545 additions and 392 deletions

View File

@@ -1,7 +1,9 @@
import { inject, injectable } from '@theia/core/shared/inversify';
import { Emitter } from '@theia/core/lib/common/event';
import { OutputContribution } from '@theia/output/lib/browser/output-contribution';
import { OutputChannelManager } from '@theia/output/lib/browser/output-channel';
import {
OutputChannelManager,
OutputChannelSeverity,
} from '@theia/output/lib/browser/output-channel';
import {
OutputMessage,
ProgressMessage,
@@ -10,13 +12,10 @@ import {
@injectable()
export class ResponseServiceImpl implements ResponseServiceArduino {
@inject(OutputContribution)
protected outputContribution: OutputContribution;
@inject(OutputChannelManager)
protected outputChannelManager: OutputChannelManager;
private readonly outputChannelManager: OutputChannelManager;
protected readonly progressDidChangeEmitter = new Emitter<ProgressMessage>();
private readonly progressDidChangeEmitter = new Emitter<ProgressMessage>();
readonly onProgressDidChange = this.progressDidChangeEmitter.event;
@@ -25,13 +24,22 @@ export class ResponseServiceImpl implements ResponseServiceArduino {
}
appendToOutput(message: OutputMessage): void {
const { chunk } = message;
const { chunk, severity } = message;
const channel = this.outputChannelManager.getChannel('Arduino');
channel.show({ preserveFocus: true });
channel.append(chunk);
channel.append(chunk, mapSeverity(severity));
}
reportProgress(progress: ProgressMessage): void {
this.progressDidChangeEmitter.fire(progress);
}
}
function mapSeverity(severity?: OutputMessage.Severity): OutputChannelSeverity {
if (severity === OutputMessage.Severity.Error) {
return OutputChannelSeverity.Error;
} else if (severity === OutputMessage.Severity.Warning) {
return OutputChannelSeverity.Warning;
}
return OutputChannelSeverity.Info;
}