15
我想在Scala REPL中禁用字符串值的截斷。Scala 2.9中的settings.maxPrintString REPL
以下螺紋提示輸入settings.maxPrintString = 0
:
How to force interpreter show complete stack trace?
不幸的是,這似乎並沒有使用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
^
有什麼我需要進口?
我試過:power
,這使得settings
可用,但它似乎並不支持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
我看到scala.tools.nsc.InterpreterSettings.maxPrintString
存在,但我不知道怎麼弄的InterpreterSettings
適當的實例修改。
謝謝retrony!我應該嘗試它所說的嘗試!我發現設置0現在似乎確實意味着零。有沒有什麼辦法可以設置無限的這些日子,或者你只需要選擇一個大數字,就像你以上所做的那樣(我嘗試了-1,但沒有運氣) – mrg 2012-03-02 08:53:39
沒關係。 Int.MaxValue會很好,並且有很好的Ctrl-R支持,我不會經常輸入它。或者我可以使用-i,使用-Yrepl-sync解決方法,因此不會掛起。 – mrg 2012-03-02 09:00:53
在Scala 2.10.3中也可以:) – 2014-03-25 22:44:49