summaryrefslogtreecommitdiff
path: root/src/repl/scala/tools/nsc/interpreter/ILoop.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2016-05-20 18:19:08 -0700
committerSom Snytt <som.snytt@gmail.com>2016-05-22 23:00:09 -0700
commit869df338617f2210217827c83d3ef9dc6d810e65 (patch)
tree4033fd7d60c7c6ba010527660006f96960bb48ae /src/repl/scala/tools/nsc/interpreter/ILoop.scala
parent99dad60d984d3f72338f3bad4c4fe905090edd51 (diff)
downloadscala-869df338617f2210217827c83d3ef9dc6d810e65.tar.gz
scala-869df338617f2210217827c83d3ef9dc6d810e65.tar.bz2
scala-869df338617f2210217827c83d3ef9dc6d810e65.zip
SI-7898 Quiet REPL at startup
Enable noisy modes only when interpreting user input.
Diffstat (limited to 'src/repl/scala/tools/nsc/interpreter/ILoop.scala')
-rw-r--r--src/repl/scala/tools/nsc/interpreter/ILoop.scala24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/repl/scala/tools/nsc/interpreter/ILoop.scala b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
index adaf3a5d25..4e0f60cf2b 100644
--- a/src/repl/scala/tools/nsc/interpreter/ILoop.scala
+++ b/src/repl/scala/tools/nsc/interpreter/ILoop.scala
@@ -908,9 +908,6 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
// we can get at it in generated code.
intp.quietBind(NamedParam[IMain]("$intp", intp)(tagOfIMain, classTag[IMain]))
- // add a help function for anyone who types "help" instead of ":help". Easily shadowed.
- //addHelp()
-
// Auto-run code via some setting.
( replProps.replAutorunCode.option
flatMap (f => File(f).safeSlurp())
@@ -938,9 +935,24 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
}
case _ =>
}
- // TODO: wait until after startup to enable obnoxious settings
- def withSuppressedSettings[A](body: =>A): A = {
- body
+ // wait until after startup to enable noisy settings
+ def withSuppressedSettings[A](body: => A): A = {
+ val ss = this.settings
+ import ss._
+ val noisy = List(Xprint, Ytyperdebug)
+ val noisesome = noisy.exists(!_.isDefault)
+ val current = (Xprint.value, Ytyperdebug.value)
+ if (isReplDebug || !noisesome) body
+ else {
+ this.settings.Xprint.value = List.empty
+ this.settings.Ytyperdebug.value = false
+ try body
+ finally {
+ Xprint.value = current._1
+ Ytyperdebug.value = current._2
+ intp.global.printTypings = current._2
+ }
+ }
}
def startup(): String = withSuppressedSettings {
// starting