From 0dbdaf8b1fb64806d35c18b362184293d46c89cb Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Wed, 9 Sep 2015 16:23:51 +1000 Subject: Hide some completion candidates on the first TAB When `foo.`, assume you don't want to see the inherited members from Any_ and universally applicable extension methods like `ensuring`. Hitting a second time includes them in the results. --- test/junit/scala/tools/nsc/interpreter/CompletionTest.scala | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') 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) } -- cgit v1.2.3