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:22 UTC
[1/2] incubator-toree git commit: Added completion unit tests.
Repository: incubator-toree
Updated Branches:
refs/heads/master 8d9e1e02f -> 06903c8b1
Added completion unit tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-toree/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-toree/commit/06903c8b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-toree/tree/06903c8b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-toree/diff/06903c8b
Branch: refs/heads/master
Commit: 06903c8b13225a198593500a9f02c343b8e5da7b
Parents: 10e964b
Author: Marius van Niekerk <ma...@gmail.com>
Authored: Fri Sep 23 09:45:46 2016 -0400
Committer: Marius van Niekerk <ma...@gmail.com>
Committed: Tue Sep 27 11:17:12 2016 -0400
----------------------------------------------------------------------
.../interpreter/scala/ScalaInterpreterSpecific.scala | 2 +-
test_toree.py | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/06903c8b/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 49361c0..4d029d3 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
@@ -285,7 +285,7 @@ trait ScalaInterpreterSpecific extends SettingsProducerLike { this: ScalaInterpr
//iMain.initializeSynchronous()
logger.debug("Initializing completer")
- completer = new PresentationCompilerCompleter.(iMain)
+ completer = new PresentationCompilerCompleter(iMain)
iMain.beQuietDuring {
//logger.info("Rerouting Console and System related input and output")
http://git-wip-us.apache.org/repos/asf/incubator-toree/blob/06903c8b/test_toree.py
----------------------------------------------------------------------
diff --git a/test_toree.py b/test_toree.py
index 3ef098a..d10a0f7 100644
--- a/test_toree.py
+++ b/test_toree.py
@@ -43,6 +43,19 @@ class ToreeScalaKernelTests(jupyter_kernel_test.KernelTests):
{'code': '%AddJar http://0.0.0.0:8000/TestJar.jar\nimport com.ibm.testjar.TestClass\nprintln(new TestClass().sayHello("Person"))', 'result': 'Hello, Person\n'}
]
+ completion_samples = [
+ # completion for some scala code
+ {
+ 'text': 'object O { def x_y_z = 1 }; import O._; x_y',
+ 'matches': {'x_y_z'},
+ },
+ # completion for bound variable
+ {
+ 'text': 'spar',
+ 'matches': {'spark'}
+ },
+ ]
+
def test_scala_stdout(self):
'''Asserts test_statements execute correctly meaning the last message is the expected result'''
for sample in self.test_statements_stdout:
[2/2] incubator-toree git commit: Get rid of semi-broken jline
completer
Posted by ch...@apache.org.
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)
}