@@ -36,10 +36,13 @@ class CompletionTest {
36
36
).completion(m1, completionItems => {
37
37
val results = CodeCompletion .simplifyResults(completionItems)
38
38
val myClass = (" MyClass" , Class , " Foo.MyClass" )
39
- assertTrue(results.contains(( " MyClass " , Class , " Foo.MyClass " )) )
39
+ val wildcard = ( " _ " , Module , " _ " )
40
40
41
- // Verify that apart from `MyClass`, we only have the methods that exists on `Foo`
42
- assertTrue((results - myClass).forall { case (_, kind, _) => kind == Method })
41
+ assertTrue(results.contains(wildcard))
42
+ assertTrue(results.contains(myClass))
43
+
44
+ // Verify that apart from `MyClass` and `wildcard`, we only have the methods that exists on `Foo`
45
+ assertTrue((results -- Set (myClass, wildcard)).forall { case (_, kind, _) => kind == Method })
43
46
44
47
// Verify that we don't have things coming from an implicit conversion, such as ensuring
45
48
assertFalse(results.exists { case (name, _, _) => name == " ensuring" })
@@ -175,4 +178,24 @@ class CompletionTest {
175
178
|} """ .withSource
176
179
.completion(m1, results => assertTrue(results.nonEmpty))
177
180
}
181
+
182
+ @ Test def noWildcardOutsideImport : Unit = {
183
+ code """ class Foo { def bar = 0 }
184
+ |object Bar {
185
+ | val foo = new Foo
186
+ | foo. ${m1}
187
+ |} """ .withSource
188
+ .completion(m1, results => {
189
+ assertFalse(" `_` was a completion result" , results.exists(_.getLabel == " _" ))
190
+ assertTrue(results.forall(_.getKind == Method ))
191
+ })
192
+ }
193
+
194
+ @ Test def importCompletionShowWildcard : Unit = {
195
+ code """ import java. ${m1}""" .withSource
196
+ .completion(m1, results => {
197
+ assertTrue(results.exists(r => r.getLabel == " _" ))
198
+ assertTrue(results.forall(_.getKind == Module ))
199
+ })
200
+ }
178
201
}
0 commit comments