summaryrefslogtreecommitdiff
path: root/test/junit
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2015-09-09 16:23:51 +1000
committerJason Zaugg <jzaugg@gmail.com>2015-09-09 16:31:29 +1000
commit0dbdaf8b1fb64806d35c18b362184293d46c89cb (patch)
tree5f31c5282c20da2af4ece8212478a6f6b6649634 /test/junit
parente3f025c1e4fbef83528ab189b37e13ebdf1b9a72 (diff)
downloadscala-0dbdaf8b1fb64806d35c18b362184293d46c89cb.tar.gz
scala-0dbdaf8b1fb64806d35c18b362184293d46c89cb.tar.bz2
scala-0dbdaf8b1fb64806d35c18b362184293d46c89cb.zip
Hide some completion candidates on the first TAB
When `foo.<TAB>`, assume you don't want to see the inherited members from Any_ and universally applicable extension methods like `ensuring`. Hitting <TAB> a second time includes them in the results.
Diffstat (limited to 'test/junit')
-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 534d5ddc3a..5b35c37c7f 100644
--- a/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala
+++ b/test/junit/scala/tools/nsc/interpreter/CompletionTest.scala
@@ -133,6 +133,15 @@ class CompletionTest {
checkExact(completer, " 1.toHexString //print")(EmptyString, "scala.Predef.intWrapper(1).toHexString // : String")
}
+ @Test
+ def firstCompletionWithNoPrefixHidesUniversalMethodsAndExtensionMethods(): Unit = {
+ val intp = newIMain()
+ val completer = new PresentationCompilerCompleter(intp)
+ checkExact(completer, "case class C(a: Int, b: Int) { this.")("a", "b")
+ assert(Set("asInstanceOf", "==").diff(completer.complete("case class C(a: Int, b: Int) { this.").candidates.toSet).isEmpty)
+ checkExact(completer, "case class D(a: Int, b: Int) { this.a")("a", "asInstanceOf")
+ }
+
def checkExact(completer: PresentationCompilerCompleter, before: String, after: String = "")(expected: String*): Unit = {
assertEquals(expected.toSet, completer.complete(before, after).candidates.toSet)
}