-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[output] add severity/color to appendLine method
Signed-off-by: Amiram Wingarten <amiram.wingarten@sap.com>
- Loading branch information
Showing
7 changed files
with
79 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
examples/api-samples/src/browser/output/sample-output-channel-with-severity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2020 SAP SE or an SAP affiliate company and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
import { FrontendApplicationContribution } from '@theia/core/lib/browser'; | ||
import { inject, injectable, interfaces } from 'inversify'; | ||
import { OutputChannelManager, OutputChannelSeverity } from '@theia/output/lib/common/output-channel'; | ||
|
||
@injectable() | ||
export class SampleOutputChannelWithSeverity | ||
implements FrontendApplicationContribution { | ||
@inject(OutputChannelManager) | ||
protected readonly outputChannelManager: OutputChannelManager; | ||
public onStart(): void { | ||
const channel = this.outputChannelManager.getChannel('my test channel'); | ||
channel.appendLine('hello info1'); // showed without color | ||
channel.appendLine('hello info2', OutputChannelSeverity.Info); | ||
channel.appendLine('hello error', OutputChannelSeverity.Error); | ||
channel.appendLine('hello warning', OutputChannelSeverity.Warning); | ||
} | ||
} | ||
export const bindSampleOutputChannelWithSeverity = (bind: interfaces.Bind) => { | ||
bind(FrontendApplicationContribution) | ||
.to(SampleOutputChannelWithSeverity) | ||
.inSingletonScope(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters