Davide Paolo Tua
08/04/2023, 9:17 AMERROR Front-end Internal error: Failed to analyze declaration Script
File being compiled: (1,1) in script.kts
The root cause org.jetbrains.kotlin.resolve.lazy.NoDescriptorForDeclarationException was thrown at: org.jetbrains.kotlin.resolve.lazy.BasicAbsentDescriptorHandler.diagnoseDescriptorNotFound(AbsentDescriptorHandler.kt:18)])
If I add a call to dispose of the the state of the autocompleter, then it works fine (but it is slow as hell...)
The object that is in charge of the autocompletion looks like:
private val autocompleter = KJvmReplCompilerWithIdeServices(defaultJvmScriptingHostConfiguration)
suspend fun autocomplete(script: String, position: SourceCode.Position): Outcome {
val injectedLines = injectedScript.lines().size - 1
val adjustedPosition = position.copy(line = position.line + injectedLines)
val sourceCode = withTiming("Creating script") { getSourceCode(script, injectedScript) }
//autocompleter.state.dispose() <-- uncommenting this one works, but is really slow>, commenting it make it crash badly
val result = withTimingNonBlocking("Autocomplete Duration") {
autocompleter.complete(
sourceCode,
adjustedPosition,
compileConfig
)
}
Does anyone have any idea on why it crashes without the dispose() call?Ilya Muradyan
08/10/2023, 11:00 AMorg.jetbrains.kotlin.resolve.lazy.NoDescriptorForDeclarationException
?Ilya Muradyan
08/10/2023, 11:12 AMKJvmReplCompilerWithIdeServices
in Jupyter kernel, completion works there.
I suspect the problem in using compileConfiguration. Try to initialize service with the same config that you use for completionDavide Paolo Tua
08/11/2023, 11:04 AMIlya Muradyan
08/11/2023, 12:36 PM