[ui] Activate the Output view.

- When new output arrives from the daemon.
 - Make sure, the current output channel is selected
before appending any message to it.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2019-05-07 10:19:32 +02:00 committed by Christian Weichel
parent ab214f8426
commit e14ac4a396
2 changed files with 11 additions and 4 deletions

View File

@ -1,6 +1,7 @@
import { ToolOutputServiceClient } from "../../common/protocol/tool-output-service";
import { injectable, inject } from "inversify";
import { OutputChannelManager } from "@theia/output/lib/common/output-channel";
import { OutputContribution } from "@theia/output/lib/browser/output-contribution";
@injectable()
export class ToolOutputServiceClientImpl implements ToolOutputServiceClient {
@ -8,9 +9,15 @@ export class ToolOutputServiceClientImpl implements ToolOutputServiceClient {
@inject(OutputChannelManager)
protected readonly outputChannelManager: OutputChannelManager;
@inject(OutputContribution)
protected readonly outputContribution: OutputContribution;
onNewOutput(tool: string, chunk: string): void {
const channel = this.outputChannelManager.getChannel(`Arduino: ${tool}`);
channel.append(chunk);
this.outputContribution.openView({ reveal: true }).then(() => {
const channel = this.outputChannelManager.getChannel(`Arduino: ${tool}`);
channel.setVisibility(true);
channel.append(chunk);
})
}
}

View File

@ -33,13 +33,13 @@ export class ArduinoDaemon implements BackendApplicationContribution {
});
if (daemon.stdout) {
daemon.stdout.on('data', data => {
this.toolOutputService.publishNewOutput("daemon", data.toString());
this.toolOutputService.publishNewOutput('daemon', data.toString());
DaemonLog.log(this.logger, data.toString());
});
}
if (daemon.stderr) {
daemon.stderr.on('data', data => {
this.toolOutputService.publishNewOutput("daemon error", data.toString());
this.toolOutputService.publishNewOutput('daemon error', data.toString());
DaemonLog.log(this.logger, data.toString());
});
}