mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-21 16:16:11 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user