Skip to content
Snippets Groups Projects
Commit 63da22c0 authored by Matei Zaharia's avatar Matei Zaharia
Browse files

Update REPL code to use our own version of JLineReader, which fixes #89.

I'm not entirely sure why this broke in the jump from Scala 2.9.0.1 to
2.9.1 -- maybe something about name resolution changed?
parent 3fad5e58
No related branches found
No related tags found
No related merge requests found
...@@ -802,13 +802,13 @@ class SparkILoop(in0: Option[BufferedReader], val out: PrintWriter, val master: ...@@ -802,13 +802,13 @@ class SparkILoop(in0: Option[BufferedReader], val out: PrintWriter, val master:
def chooseReader(settings: Settings): InteractiveReader = { def chooseReader(settings: Settings): InteractiveReader = {
if (settings.Xnojline.value || Properties.isEmacsShell) if (settings.Xnojline.value || Properties.isEmacsShell)
SimpleReader() SimpleReader()
else try JLineReader( else try SparkJLineReader(
if (settings.noCompletion.value) NoCompletion if (settings.noCompletion.value) NoCompletion
else new JLineCompletion(intp) else new SparkJLineCompletion(intp)
) )
catch { catch {
case ex @ (_: Exception | _: NoClassDefFoundError) => case ex @ (_: Exception | _: NoClassDefFoundError) =>
echo("Failed to created JLineReader: " + ex + "\nFalling back to SimpleReader.") echo("Failed to created SparkJLineReader: " + ex + "\nFalling back to SimpleReader.")
SimpleReader() SimpleReader()
} }
} }
...@@ -985,7 +985,7 @@ object SparkILoop { ...@@ -985,7 +985,7 @@ object SparkILoop {
repl.settings = new Settings(echo) repl.settings = new Settings(echo)
repl.settings.embeddedDefaults[T] repl.settings.embeddedDefaults[T]
repl.createInterpreter() repl.createInterpreter()
repl.in = JLineReader(repl) repl.in = SparkJLineReader(repl)
// rebind exit so people don't accidentally call sys.exit by way of predef // rebind exit so people don't accidentally call sys.exit by way of predef
repl.quietRun("""def exit = println("Type :quit to resume program execution.")""") repl.quietRun("""def exit = println("Type :quit to resume program execution.")""")
......
...@@ -15,7 +15,7 @@ import collection.mutable.ListBuffer ...@@ -15,7 +15,7 @@ import collection.mutable.ListBuffer
// REPL completor - queries supplied interpreter for valid // REPL completor - queries supplied interpreter for valid
// completions based on current contents of buffer. // completions based on current contents of buffer.
class JLineCompletion(val intp: SparkIMain) extends Completion with CompletionOutput { class SparkJLineCompletion(val intp: SparkIMain) extends Completion with CompletionOutput {
val global: intp.global.type = intp.global val global: intp.global.type = intp.global
import global._ import global._
import definitions.{ PredefModule, RootClass, AnyClass, AnyRefClass, ScalaPackage, JavaLangPackage } import definitions.{ PredefModule, RootClass, AnyClass, AnyRefClass, ScalaPackage, JavaLangPackage }
......
...@@ -73,7 +73,7 @@ class SparkJLineReader(val completion: Completion) extends InteractiveReader { ...@@ -73,7 +73,7 @@ class SparkJLineReader(val completion: Completion) extends InteractiveReader {
def readOneKey(prompt: String) = consoleReader readOneKey prompt def readOneKey(prompt: String) = consoleReader readOneKey prompt
} }
object JLineReader { object SparkJLineReader {
def apply(intp: SparkIMain): JLineReader = apply(new JLineCompletion(intp)) def apply(intp: SparkIMain): SparkJLineReader = apply(new SparkJLineCompletion(intp))
def apply(comp: Completion): JLineReader = new JLineReader(comp) def apply(comp: Completion): SparkJLineReader = new SparkJLineReader(comp)
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment