Skip to content

Commit

Permalink
REPL bells and whistles: -Dscala.repl.maxprintstring=<Integer>
Browse files Browse the repository at this point in the history
Makes `maxPrintString` configurable and fixes its treatment at zero.
Quite useful for debugging elaborate classloaders with long classpaths.
  • Loading branch information
xeno-by committed Jun 8, 2012
1 parent 2aaccfe commit c74533a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/interpreter/IMain.scala
Expand Up @@ -1228,7 +1228,7 @@ object IMain {
def maxStringLength: Int
def isTruncating: Boolean
def truncate(str: String): String = {
if (isTruncating && str.length > maxStringLength)
if (isTruncating && (maxStringLength != 0 && str.length > maxStringLength))
(str take maxStringLength - 3) + "..."
else str
}
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/interpreter/ISettings.scala
Expand Up @@ -24,7 +24,7 @@ class ISettings(intp: IMain) {
* more than this number of characters, then the printout is
* truncated.
*/
var maxPrintString = 800
var maxPrintString = replProps.maxPrintString.option.getOrElse(800)

/** The maximum number of completion candidates to print for tab
* completion without requiring confirmation.
Expand Down
3 changes: 3 additions & 0 deletions src/compiler/scala/tools/nsc/interpreter/ReplProps.scala
Expand Up @@ -7,9 +7,11 @@ package scala.tools.nsc
package interpreter

import scala.sys._
import Prop._

class ReplProps {
private def bool(name: String) = BooleanProp.keyExists(name)
private def int(name: String) = IntProp(name)

val jlineDebug = bool("scala.tools.jline.internal.Log.debug")
val jlineTrace = bool("scala.tools.jline.internal.Log.trace")
Expand All @@ -25,4 +27,5 @@ class ReplProps {
val powerBanner = Prop[JFile]("scala.repl.power.banner")

val vids = bool("scala.repl.vids")
val maxPrintString = int("scala.repl.maxprintstring")
}

0 comments on commit c74533a

Please sign in to comment.