summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-09-24 13:22:29 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-09-24 14:33:19 +1000
commit2c9e506bc32248f9ae4929790a0cb7484a53a66e (patch)
tree67ed4da07b4ad128803bf4bfa5b253fad0417b42 /test
parenta6c1687aa762bc8317fe4995ec1b26bed64865e8 (diff)
downloadscala-2c9e506bc32248f9ae4929790a0cb7484a53a66e.tar.gz
scala-2c9e506bc32248f9ae4929790a0cb7484a53a66e.tar.bz2
scala-2c9e506bc32248f9ae4929790a0cb7484a53a66e.zip
Support completion in erroneous string interpolation.
In the code: ``` s"${fooo<CURSOR" ``` The parser treats `fooo` as a interpolator ID for the quote that we actually intend to end the interpolated string. Inserting a space (in addition to `__CURSOR__` that we already patch in to avoid parsing a partial identifier as a keyword), solves this problem.
Diffstat (limited to 'test')
-rw-r--r--test/junit/scala/tools/nsc/interpreter/CompletionTest.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala b/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala
index 514f30571e..d00a9bf69a 100644
--- a/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala
+++ b/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala
@@ -52,6 +52,14 @@ class CompletionTest {
}
@Test
+ def incompleteStringInterpolation(): Unit = {
+ val intp = newIMain()
+ val completer = new PresentationCompilerCompleter(intp)
+ checkExact(completer, """val x_y_z = 1; s"${x_""", "}\"")("x_y_z")
+ checkExact(completer, """val x_y_z = 1; s"${x_""", "\"")("x_y_z")
+ }
+
+ @Test
def symbolically(): Unit = {
val intp = newIMain()
val completer = new PresentationCompilerCompleter(intp)