You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@toree.apache.org by ch...@apache.org on 2016/09/27 16:45:23 UTC

[2/2] incubator-toree git commit: Get rid of semi-broken jline completer

Get rid of semi-broken jline completer


Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/10e964b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/10e964b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/10e964b4

Branch: refs/heads/master
Commit: 10e964b484e99631d9b0ac8bbec1fca269f67307
Parents: 8d9e1e0
Author: Marius van Niekerk <ma...@maxpoint.com>
Authored: Thu Sep 22 21:41:08 2016 -0400
Committer: Marius van Niekerk <ma...@gmail.com>
Committed: Tue Sep 27 11:17:12 2016 -0400

----------------------------------------------------------------------
 .../interpreter/scala/ScalaInterpreterSpecific.scala  | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/10e964b4/scala-interpreter/src/main/scala-2.11/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpecific.scala
----------------------------------------------------------------------
diff --git a/scala-interpreter/src/main/scala-2.11/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpecific.scala b/scala-interpreter/src/main/scala-2.11/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpecific.scala
index bd8f972..49361c0 100644
--- a/scala-interpreter/src/main/scala-2.11/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpecific.scala
+++ b/scala-interpreter/src/main/scala-2.11/org/apache/toree/kernel/interpreter/scala/ScalaInterpreterSpecific.scala
@@ -35,7 +35,7 @@ trait ScalaInterpreterSpecific extends SettingsProducerLike { this: ScalaInterpr
   private val ExecutionExceptionName = "lastException"
 
   private var iMain: IMain = _
-  private var jLineCompleter: JLineCompletion = _
+  private var completer: PresentationCompilerCompleter = _
   private val exceptionHack = new ExceptionHack()
 
   def _runtimeClassloader = {
@@ -192,7 +192,7 @@ trait ScalaInterpreterSpecific extends SettingsProducerLike { this: ScalaInterpr
     taskManager = null
 
     // Erase our completer
-    jLineCompleter = null
+    completer = null
 
     // Close the entire interpreter (loses all state)
     if (iMain != null) iMain.close()
@@ -285,7 +285,7 @@ trait ScalaInterpreterSpecific extends SettingsProducerLike { this: ScalaInterpr
     //iMain.initializeSynchronous()
 
     logger.debug("Initializing completer")
-    jLineCompleter = new JLineCompletion(iMain)
+    completer = new PresentationCompilerCompleter.(iMain)
 
     iMain.beQuietDuring {
       //logger.info("Rerouting Console and System related input and output")
@@ -309,14 +309,10 @@ trait ScalaInterpreterSpecific extends SettingsProducerLike { this: ScalaInterpr
    * @return The cursor position and list of possible completions
    */
   override def completion(code: String, pos: Int): (Int, List[String]) = {
-    require(jLineCompleter != null)
+    require(completer != null)
 
     logger.debug(s"Attempting code completion for ${code}")
-    val regex = """[0-9a-zA-Z._]+$""".r
-    val parsedCode = (regex findAllIn code).mkString("")
-
-    logger.debug(s"Attempting code completion for ${parsedCode}")
-    val result = jLineCompleter.completer().complete(parsedCode, pos)
+    val result = completer.complete(code, pos)
 
     (result.cursor, result.candidates)
   }