-
-
Notifications
You must be signed in to change notification settings - Fork 435
/
Copy pathoutput-service-impl.ts
28 lines (22 loc) · 1.22 KB
/
output-service-impl.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { inject, injectable } from 'inversify';
import { OutputContribution } from '@theia/output/lib/browser/output-contribution';
import { OutputChannelManager } from '@theia/output/lib/common/output-channel';
import { OutputService, OutputMessage } from '../common/protocol/output-service';
@injectable()
export class OutputServiceImpl implements OutputService {
@inject(OutputContribution)
protected outputContribution: OutputContribution;
@inject(OutputChannelManager)
protected outputChannelManager: OutputChannelManager;
append(message: OutputMessage): void {
const { name, chunk } = message;
const channel = this.outputChannelManager.getChannel(`Arduino: ${name}`);
// Zen-mode: we do not reveal the output for daemon messages.
const show: Promise<any> = name === 'daemon'
// This will open and reveal the view but won't show it. You will see the toggle bottom panel on the status bar.
? this.outputContribution.openView({ activate: false, reveal: false })
// This will open, reveal but do not activate the Output view.
: Promise.resolve(channel.show({ preserveFocus: true }));
show.then(() => channel.append(chunk));
}
}