@@ -253,7 +253,7 @@ class EditCallTest : SingleFileTestFixture("completions", "EditCall.kt") {
253
253
val labels = completions.items.map { it.label }
254
254
255
255
assertThat(labels, hasItem(startsWith(" println" )))
256
- assertThat(completions.items.filter { it.label.startsWith(" println" ) }.firstOrNull() , hasProperty(" insertText" , equalTo(" println" )))
256
+ assertThat(completions.items.find { it.label.startsWith(" println" ) }, hasProperty(" insertText" , equalTo(" println" )))
257
257
}
258
258
}
259
259
@@ -265,3 +265,21 @@ class EnumWithCompanionObjectTest : SingleFileTestFixture("completions", "Enum.k
265
265
assertThat(labels, hasItem(" ILLEGAL" ))
266
266
}
267
267
}
268
+
269
+ class TrailingLambdaTest : SingleFileTestFixture (" completions" , " TrailingLambda.kt" ) {
270
+ @Test fun `complete function with single lambda parameter` () {
271
+ val completions = languageServer.textDocumentService.completion(completionParams(file, 6 , 9 )).get().right!!
272
+ val labels = completions.items.map { it.label }
273
+
274
+ assertThat(labels, hasItem(startsWith(" lambdaParameter" )))
275
+ assertThat(completions.items.find { it.label.startsWith(" lambdaParameter" ) }, hasProperty(" insertText" , equalTo(" lambdaParameter { \$ {1:x} }" )))
276
+ }
277
+
278
+ @Test fun `complete function with mixed parameters` () {
279
+ val completions = languageServer.textDocumentService.completion(completionParams(file, 7 , 8 )).get().right!!
280
+ val labels = completions.items.map { it.label }
281
+
282
+ assertThat(labels, hasItem(startsWith(" mixedParameters" )))
283
+ assertThat(completions.items.find { it.label.startsWith(" mixedParameters" ) }, hasProperty(" insertText" , equalTo(" mixedParameters(\$ {1:a}) { \$ {2:b} }" )))
284
+ }
285
+ }
0 commit comments