It seems IntelliJ auto-completion for kotlin scripts does not work across @file:import("other-file.kts") Is that correct at the time of writing for you others as well?
I’m using kotlin 1.6.20, windows, IntelliJ 2021.2.4.
I can get auto-complete to work on main-kts files, but it won’t include anything from other imported file with @file:import. For example in this file I cannot auto-complete type of a if I say val a = sharedVar, because sharedVar is from another file:
In fact its only on a rare occasion that IntelliJ will auto-complete anything in files with @file:import
I also created a smaller sample library here with an autocomplete-fails.main.kts file:
No I havn’t found a solution. I don’t use kotlin scripting at the moment, I’m waiting for it to mature. Without auto-completion I would rather just have full-blown multi-dir gradle project, though the result being that I’m still mostly using powershell for small script. Sadly…
Ugh, sadly, this is still an issue. I have tons of scripts written in Kotlin, run by KScript project. Wanted to migrate them all to .main.kts to get IDE support. But sadly, there still appears to be poor support. One of the issue is the auto-completion not working for @file:import as you mentioned
Did anyone report this issue? What’s the correct place to report it?
I just got to know about main.kts and I want to make sure the issues are reported.
It has been a while. I don’t remember I found found other places to report it, but probably not. I don’t know where better to report it, maybe on github?