Allow overriding ansi mode on PlainTextMessageRenderer
#KT-55784 Fixed
This commit is contained in:
committed by
Alexander Udalov
parent
af649cbb44
commit
34947c9d7a
+14
-1
@@ -52,6 +52,19 @@ public abstract class PlainTextMessageRenderer implements MessageRenderer {
|
|||||||
|
|
||||||
private static final Set<CompilerMessageSeverity> IMPORTANT_MESSAGE_SEVERITIES = EnumSet.of(EXCEPTION, ERROR, STRONG_WARNING, WARNING);
|
private static final Set<CompilerMessageSeverity> IMPORTANT_MESSAGE_SEVERITIES = EnumSet.of(EXCEPTION, ERROR, STRONG_WARNING, WARNING);
|
||||||
|
|
||||||
|
private final boolean colorEnabled;
|
||||||
|
|
||||||
|
public PlainTextMessageRenderer() {
|
||||||
|
this(COLOR_ENABLED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This constructor is not used in this project
|
||||||
|
// but it can be useful in a compilation server to still be able to generate colored output
|
||||||
|
@SuppressWarnings("WeakerAccess")
|
||||||
|
public PlainTextMessageRenderer(boolean colorEnabled) {
|
||||||
|
this.colorEnabled = colorEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String renderPreamble() {
|
public String renderPreamble() {
|
||||||
return "";
|
return "";
|
||||||
@@ -78,7 +91,7 @@ public abstract class PlainTextMessageRenderer implements MessageRenderer {
|
|||||||
result.append(" ");
|
result.append(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (COLOR_ENABLED) {
|
if (this.colorEnabled) {
|
||||||
Ansi ansi = Ansi.ansi()
|
Ansi ansi = Ansi.ansi()
|
||||||
.bold()
|
.bold()
|
||||||
.fg(severityColor(severity))
|
.fg(severityColor(severity))
|
||||||
|
|||||||
Reference in New Issue
Block a user