summaryrefslogtreecommitdiff
path: root/src/repl/scala/tools/nsc/interpreter/PresentationCompilation.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-09-09 15:02:17 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-09-09 15:06:19 +1000
commite3f025c1e4fbef83528ab189b37e13ebdf1b9a72 (patch)
treeec8a296d23b49e1b6156f29f48b78d837a9e0162 /src/repl/scala/tools/nsc/interpreter/PresentationCompilation.scala
parent1c42e6bee90b7c444e973726e01b137584dfaad5 (diff)
downloadscala-e3f025c1e4fbef83528ab189b37e13ebdf1b9a72.tar.gz
scala-e3f025c1e4fbef83528ab189b37e13ebdf1b9a72.tar.bz2
scala-e3f025c1e4fbef83528ab189b37e13ebdf1b9a72.zip
Fix completion for multi-line entries
We need to include the previously entered lines into the code that we presentation compile. Management of this state makes the interpret method non tail recursive, so we could blow the default stack with a multi-line entry of hundreds of lines. I think thats an acceptable limitation.
Diffstat (limited to 'src/repl/scala/tools/nsc/interpreter/PresentationCompilation.scala')
-rw-r--r--src/repl/scala/tools/nsc/interpreter/PresentationCompilation.scala7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/repl/scala/tools/nsc/interpreter/PresentationCompilation.scala b/src/repl/scala/tools/nsc/interpreter/PresentationCompilation.scala
index 81c4fb0b70..3a2177a4cb 100644
--- a/src/repl/scala/tools/nsc/interpreter/PresentationCompilation.scala
+++ b/src/repl/scala/tools/nsc/interpreter/PresentationCompilation.scala
@@ -28,10 +28,9 @@ trait PresentationCompilation {
//
// scala> 1
// scala> .toInt
- val line1 = if (Completion.looksLikeInvocation(line)) {
- self.mostRecentVar + line
- } else line
-
+ //
+ // and for multi-line input.
+ val line1 = partialInput + (if (Completion.looksLikeInvocation(line)) { self.mostRecentVar + line } else line)
val compiler = newPresentationCompiler()
val trees = compiler.newUnitParser(line1).parseStats()
val importer = global.mkImporter(compiler)