Hi! I build IntelliJ plugin with inline completion provider.
I have a test to check completion for my provider.
Test pass fine on my machine, but I get “There are no inline completion context.” error in CI.
The question is, why that can happen and how can I fix it? Could you please give a clue, what is direction to debug the issue and where to look into
Do not see direct connection to environment where tests are executed
The test is like that:
@RunWith(JUnit4::class)
class InlineCompletionTest : BasePlatformTestCase() {
private val mockService = mockk<MyService>()
override fun runInDispatchThread(): Boolean {
// Requested by CodeInsightTestFixture.testInlineCompletion
return false
}
@Before
fun setupInlineCompletionProvider() {
val provider = MyCompletionProvider { mockService }
InlineCompletionHandler.registerTestHandler(provider, testRootDisposable)
}
@Test
fun `user can accept inline suggestion`() = myFixture.testInlineCompletion {
// Arrange
init(KotlinFileType.INSTANCE, "fun <caret>")
mockSingleSuggestion("ain(args: List<String>)")
// Act & Assert
typeChar('m')
delay()
assertInlineRender("ain(args: List<String>)")
insert()
assertFileContent("fun main(args: List<String>)<caret>")
}
//...
The error is like that:
java.lang.AssertionError: [There are no inline completion context.]
Expecting actual not to be null
at com.intellij.codeInsight.inline.completion.InlineCompletionLifecycleTestDSL$assertContextExists$2.invokeSuspend(InlineCompletionLifecycleTestDSL.kt:277)
at com.intellij.codeInsight.inline.completion.InlineCompletionLifecycleTestDSL$assertContextExists$2.invoke(InlineCompletionLifecycleTestDSL.kt)
at com.intellij.codeInsight.inline.completion.InlineCompletionLifecycleTestDSL$assertContextExists$2.invoke(InlineCompletionLifecycleTestDSL.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:62)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:163)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at com.intellij.codeInsight.inline.completion.InlineCompletionLifecycleTestDSL.assertContextExists(InlineCompletionLifecycleTestDSL.kt:275)
at com.intellij.codeInsight.inline.completion.InlineCompletionLifecycleTestDSL$assertInlineRender$2.invokeSuspend(InlineCompletionLifecycleTestDSL.kt:253)
at _COROUTINE._BOUNDARY._(CoroutineDebugging.kt:42)
...