Skip to content

Commit

Permalink
add a debug option to show original message in foundReqMsg
Browse files Browse the repository at this point in the history
  • Loading branch information
tribbloid committed Sep 19, 2023
1 parent 8dffef5 commit 070b336
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,13 @@ trait SplainFormattingExtension extends typechecker.splain.SplainFormatting with

val extra = mutable.Buffer.empty[String]

if (pluginSettings.debug) {

extra += "===[ ORIGINAL ERROR ]===" +
builtinFoundReqMsg(found, req) +
"\n"
}

val result = (Seq(body) ++ extra.toSeq).mkString("\n")
result
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ trait SplainPluginLike extends plugins.Plugin {
val components: List[PluginComponent] = Nil

val opts: mutable.Map[String, String] = PluginSettings.defaults.to(mutable.Map)

}
4 changes: 3 additions & 1 deletion core/src/main/scala/splain/PluginSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ case class PluginSettings(pluginOpts: mutable.Map[String, String]) {
// <= 1 : short type name
// 2 : long type name
// >= 3 : long type name with existential context

def debug: Boolean = boolean(PluginSettings.Key.debug)
}

object PluginSettings {
Expand All @@ -48,7 +50,7 @@ object PluginSettings {

val typeVerbosity = "Vtype-verbosity"

val debug = "debug"
val debug = "Vdebug"
}

val defaults: Map[String, String] = Map(
Expand Down

0 comments on commit 070b336

Please sign in to comment.