summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-09-09 12:02:31 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-09-09 12:02:31 +1000
commit1c42e6bee90b7c444e973726e01b137584dfaad5 (patch)
treecd8dde99091165218e9699ed6550cc8b623371b5 /test
parent2d025fe2d0c9cd0e01e390055b0531166988f901 (diff)
downloadscala-1c42e6bee90b7c444e973726e01b137584dfaad5.tar.gz
scala-1c42e6bee90b7c444e973726e01b137584dfaad5.tar.bz2
scala-1c42e6bee90b7c444e973726e01b137584dfaad5.zip
More liberal matching in REPL autocompletion
For the SHIFT-impaired: you can just write everything in lowercase, (whisper-case?) and we'll try to DWYM. We treat capital letters that you *do* enter as significant, they can't match a lower case letter in an identifier. Modelled after IntellIJ's completion. I still don't fall into this mode if you enter an exact prefix of a candidate, but we might consider changing that. ``` scala> classOf[String].typ<TAB> getAnnotationsByType getComponentType getDeclaredAnnotationsByType getTypeName getTypeParameters scala> classOf[String].typN<TAB> scala> classOf[String].getTypeName res3: String = java.lang.String scala> def foo(s: str<TAB> scala> def foo(s: String String StringBuffer StringBuilder StringCanBuildFrom StringContext StringFormat StringIndexOutOfBoundsException scala> def foo(s: string<TAB> scala> def foo(s: String String StringBuffer StringBuilder StringCanBuildFrom StringContext StringFormat StringIndexOutOfBoundsException ```
Diffstat (limited to 'test')
-rw-r--r--test/junit/scala/tools/nsc/interpreter/CompletionTest.scala9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala b/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala
index a55a3c66c0..534d5ddc3a 100644
--- a/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala
+++ b/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala
@@ -63,6 +63,15 @@ class CompletionTest {
}
@Test
+ def lenientCamelCompletions(): Unit = {
+ val intp = newIMain()
+ val completer = new PresentationCompilerCompleter(intp)
+ checkExact(completer, "object O { def theCatSatOnTheMat = 1 }; import O._; tcso")("theCatSatOnTheMat")
+ checkExact(completer, "object O { def theCatSatOnTheMat = 1 }; import O._; sotm")("theCatSatOnTheMat")
+ checkExact(completer, "object O { def theCatSatOnTheMat = 1 }; import O._; TCSOTM")()
+ }
+
+ @Test
def previousLineCompletions(): Unit = {
val intp = newIMain()
intp.interpret("class C { val x_y_z = 42 }")