@@ -23,8 +23,7 @@ import dotc.reporting.Diagnostic
23
23
* `ReplDriver#resetToInitial` is called, the accompanying instance of
24
24
* `Rendering` is no longer valid.
25
25
*/
26
- private [repl] class Rendering (parentClassLoader : Option [ClassLoader ] = None ,
27
- maxPrintElements : Int = 1000 ) {
26
+ private [repl] class Rendering (parentClassLoader : Option [ClassLoader ] = None ) {
28
27
29
28
import Rendering ._
30
29
@@ -33,7 +32,7 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None,
33
32
private var myReplStringOf : Object => String = _
34
33
35
34
/** Class loader used to load compiled code */
36
- private [repl] def classLoader ()(using Context ) =
35
+ private [repl] def classLoader ()(using ctx : Context ) =
37
36
if (myClassLoader != null && myClassLoader.root == ctx.settings.outputDir.value) myClassLoader
38
37
else {
39
38
val parent = Option (myClassLoader).orElse(parentClassLoader).getOrElse {
@@ -49,6 +48,7 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None,
49
48
}
50
49
51
50
myClassLoader = new AbstractFileClassLoader (ctx.settings.outputDir.value, parent)
51
+ val maxPrintElements = ctx.settings.VreplMaxPrintElements .valueIn(ctx.settingsState)
52
52
myReplStringOf = {
53
53
// We need to use the ScalaRunTime class coming from the scala-library
54
54
// on the user classpath, and not the one available in the current
@@ -78,7 +78,8 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None,
78
78
* then this bug will surface, so perhaps better not?
79
79
* https://github.com/scala/bug/issues/12337
80
80
*/
81
- private [repl] def truncate (str : String ): String = {
81
+ private [repl] def truncate (str : String )(using ctx : Context ): String = {
82
+ val maxPrintElements = ctx.settings.VreplMaxPrintElements .valueIn(ctx.settingsState)
82
83
val showTruncated = " ... large output truncated, print value to show all"
83
84
val ncp = str.codePointCount(0 , str.length) // to not cut inside code point
84
85
if ncp <= maxPrintElements then str
0 commit comments