Skip to content

Commit

Permalink
bugfix: Work around fansi escaping issues
Browse files Browse the repository at this point in the history
Previously, some error messages might have been not able to be printed due to a bug in fansi com-lihaoyi/fansi#46

Now, we added a workaround that should help out here.

Fixes scalameta#730
  • Loading branch information
tgodzik committed Dec 15, 2022
1 parent 03bdc52 commit 78d8150
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions mdoc/src/main/scala/mdoc/internal/io/ConsoleReporter.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package mdoc.internal.io

import coursierapi.Logger
import fansi.ErrorMode
import fansi.Str
import mdoc.Reporter
import mdoc.internal.pos.PositionSyntax._

import java.io.PrintStream
import java.util.concurrent.atomic.AtomicBoolean
import scala.meta.Position
import mdoc.Reporter
import mdoc.internal.pos.PositionSyntax._
import coursierapi.Logger

class ConsoleReporter(
ps: PrintStream,
Expand Down Expand Up @@ -49,24 +52,24 @@ class ConsoleReporter(
}
def error(msg: String): Unit = {
myErrors += 1
ps.println(myError ++ s": $msg")
ps.println(myError ++ Str(s": $msg", ErrorMode.Strip))
}
def warning(pos: Position, msg: String): Unit = {
warning(formatMessage(pos.toUnslicedPosition, "warning", msg))
}
def warning(msg: String): Unit = {
myWarnings += 1
ps.println(myWarning ++ s": $msg")
ps.println(myWarning ++ Str(s": $msg", ErrorMode.Strip))
}
def info(pos: Position, msg: String): Unit = {
info(formatMessage(pos.toUnslicedPosition, "info", msg))
}
def info(msg: String): Unit = {
ps.println(myInfo ++ s": $msg")
ps.println(myInfo ++ Str(s": $msg", ErrorMode.Strip))
}
def debug(msg: => String): Unit = {
if (isDebugEnabled.get()) {
ps.println(myDebug ++ s": $msg")
ps.println(myDebug ++ Str(s": $msg", ErrorMode.Strip))
}
}

Expand Down

0 comments on commit 78d8150

Please sign in to comment.