File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
compiler/src/dotty/tools/dotc/reporting Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -205,8 +205,8 @@ trait MessageRendering {
205205 def explanation (m : Message )(using Context ): String = {
206206 val sb = new StringBuilder (
207207 s """ |
208- | ${fansi.Color .Blue (" Explanation" ).render}
209- | ${fansi.Color .Blue (" ===========" ).render}""" .stripMargin
208+ | ${if ctx.useColors then fansi.Color .Blue (" Explanation" ).render else " Explanation " }
209+ | ${if ctx.useColors then fansi.Color .Blue (" ===========" ).render else " =========== " }""" .stripMargin
210210 )
211211 sb.append(EOL ).append(m.explanation)
212212 if (! m.explanation.endsWith(EOL )) sb.append(EOL )
@@ -305,10 +305,12 @@ trait MessageRendering {
305305 }
306306
307307 private def hl (str : String )(using Context , Level ): String =
308- summon[Level ].value match
309- case interfaces.Diagnostic .ERROR => fansi.Color .Red (str).render
310- case interfaces.Diagnostic .WARNING => fansi.Color .Yellow (str).render
311- case interfaces.Diagnostic .INFO => fansi.Color .Blue (str).render
308+ if ctx.useColors then
309+ summon[Level ].value match
310+ case interfaces.Diagnostic .ERROR => fansi.Color .Red (str).render
311+ case interfaces.Diagnostic .WARNING => fansi.Color .Yellow (str).render
312+ case interfaces.Diagnostic .INFO => fansi.Color .Blue (str).render
313+ else str
312314
313315 private def diagnosticLevel (dia : Diagnostic ): String =
314316 dia match {
You can’t perform that action at this time.
0 commit comments