Skip to content

Commit f83a1b1

Browse files
committed
.
1 parent b182b3d commit f83a1b1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler/src/dotty/tools/repl/Rendering.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,13 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None):
9191
/** Return a colored fansi.Str representation of a value we got from `classLoader()`. */
9292
private[repl] def replStringOf(value: Object, prefixLength: Int)(using Context): fansi.Str = {
9393
// pretty-print things with 100 cols 50 rows by default,
94-
pprintRender(
94+
val res = pprintRender(
9595
value,
9696
width = 100,
9797
height = 50,
9898
initialOffset = prefixLength
9999
)
100+
if (ctx.settings.color.value == "never") fansi.Str(res).plainText else res
100101
}
101102

102103
/** Load the value of the symbol using reflection.
@@ -184,7 +185,9 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None):
184185
ste.getClassName.startsWith(REPL_WRAPPER_NAME_PREFIX) // d.symbol.owner.name.show is simple name
185186
&& (ste.getMethodName == nme.STATIC_CONSTRUCTOR.show || ste.getMethodName == nme.CONSTRUCTOR.show)
186187

187-
infoDiagnostic(cause.formatStackTracePrefix(!isWrapperInitialization(_)), d)
188+
val formatted0 = cause.formatStackTracePrefix(!isWrapperInitialization(_))
189+
val formatted: fansi.Str = if (ctx.settings.color.value == "never") formatted0.plainText else formatted0
190+
infoDiagnostic(formatted, d)
188191
end renderError
189192

190193
private def infoDiagnostic(msg: fansi.Str, d: Denotation)(using Context): Diagnostic = {

0 commit comments

Comments
 (0)