<@U0CHHN4F4> is there anything different about how...
# scripting
g
@ilya.chernikov is there anything different about how completion contributors or import suggestions are done in the IDE for kotlin scripts? I have a script definition whose scripts are unable to get code assistance on imports or symbol names (and has been that way since around 1.3.40). I'm looking into debugging the Kotlin plugin now, but it's a little difficult without an easy way to configure debug sources.
i
There should not be any differences, but the scope for the suggestions maybe configured differently. If you describe your setup - where the script is located and how dependencies are collected - I could be able to give more clues.
1
g
hi @ilya.chernikov, I'll put together a minimal reproducer and put it on GitHub. The gist is a multi-module Gradle project with the kotlin script configuration defined in one module, and referenced by a script in another (without any binaries being built). I've been doing a bit of debugging and believe it's an issue with how
dependenciesFromClasspath
works inside the IDE.
still putting together that reproducer, but here's the issue as I understand it: when this index (https://github.com/JetBrains/kotlin/blob/7f8774f68e6ada142aeb044d29c7cfa1abe050a0/idea/idea-core/src/org/jetbrains/kotlin/idea/core/KotlinIndicesHelper.kt#L390) is resolved for a script, it is empty, but when I resolve it for a .kt file in the same project it resolves to a list containing the class name. My theory at the moment is that something is different about how the stub indexes interact with scripts.
i
Thank you for the repro, I'll try to have look at it in the next few days.
g
thanks, I have a reproducer ready and will push to GitHub shortly. will ping you a link
hi @ilya.chernikov, sorry for the delay. I put together a reproducer and identified the problem: https://github.com/JetBrains/kotlin/pull/3361
I think that fix is a bit heavy-handed, but it indeed does the job. Maybe there should be a way for a script inside a module to produce a
ModuleInfo
describing that fact.
if this is the correct path to a fix I'm happy to add new tests for it and do that
i
Thanks, @Gary Tierney. I passed it to the people more knowledgeable in this area.