I'd like to disable truncation of string values in the Scala REPL.
The following thread suggested typing settings.maxPrintString = 0
:
How to force interpreter show complete stack trace?
Unfortunately, this doesn't seem to work with Scala 2.9:
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_29).
Type in expressions to have them evaluated.
Type :help for more information.
scala> settings.maxPrintString = 0
<console>:10: error: not found: value settings
val $ires0 = settings.maxPrintString
^
<console>:7: error: not found: value settings
settings.maxPrintString = 0
^
Is there something I need to import?
I tried :power
, which makes settings
available, but it doesn't seem to support maxPrintString
:
scala> :power
** Power User mode enabled - BEEP BOOP SPIZ **
** :phase has been set to 'typer'. **
** scala.tools.nsc._ has been imported **
** global._ and definitions._ also imported **
** Try :help, vals.<tab>, power.<tab> **
scala> settings
res0: scala.tools.nsc.Settings =
Settings {
-d = .
-Yrich-exceptions = true
-classpath = bin:lib/*
-encoding = UTF-8
}
scala> settings.maxPrintString = 0
<console>:31: error: value maxPrintString is not a member of scala.tools.nsc.Settings
val $ires9 = settings.maxPrintString
^
<console>:28: error: value maxPrintString is not a member of scala.tools.nsc.Settings
settings.maxPrintString = 0
I see that scala.tools.nsc.InterpreterSettings.maxPrintString
exists, but I'm not sure how to get an appropriate instance of InterpreterSettings
to modify.
~/code/scala scala29
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_29).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :power
** Power User mode enabled - BEEP BOOP SPIZ **
** :phase has been set to 'typer'. **
** scala.tools.nsc._ has been imported **
** global._ and definitions._ also imported **
** Try :help, vals.<tab>, power.<tab> **
scala> vals.isettings.maxPrintString
maxPrintString maxPrintString_=
scala> vals.isettings.maxPrintString = 10000
vals.isettings.maxPrintString: Int = 10000
or
$ scala -uniqid -Xprint:typer -Yshow-syms -Dscala.repl.maxprintstring=64000
where the sample output will show truncation without the higher limit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With