Hi! I was using kscript before but since it's not ...
# scripting
d
Hi! I was using kscript before but since it's not migrated to Kotlin 1.5 I've decided to try native Kotlin scripting. Question is: do we have proper IDE support or it's completely broken yet? When I'm opening
.main.kts
script in IDEA I have such issues: • JDK is not found (
import java.*
not recognized) even when I'm selecting proper JDK version manually in module settings. • Auto-completion doesn't work for classes included with
@file:DependsOn()
. Is this expected behavior? Thanks.
Oh, I see few people recently have similar issues
m
🙏🏼 1
But it's working for me in: IntelliJ Kotlin Plugin
Copy code
212-1.6.0-release-799-IJ5457.46
h
Just out of curiosity @dector: Why did you rely on kscript being compiled against v1.5? It's meant to work with all current versions of kotlin.
Since kscript is agnostic of the used API version of kotlin in your scripts, its own binary compile reference should not matter all. I can not imagine a single usecase where it would matter actually.
d
@holgerbrandl hm, but does this mean that embedded stdlib in kscript will be 1.4? Or am I missing something? 🤔
h
Kscript is using process substitution which is a linux concept to replace the running process. So it will compile your script by simply running kotlinc as it comes from your PATH, and start the application. As soon as your script is running using kotlin binary from your PATH, kscript has faded away into the void. So there is no limitation to 1.4 from a user perspective.
a
Hi! I have the same issue. The syntax highlight and annotations in
*.main.kts
scripts are not working on inner folders different than root but working at root project level. I’ve downloaded the
kotlin-script-examples
project and the
jvm/main-kts/scripts/kotlin-shell.main.kts
is not working but copying that script to the root project folder it works. Anyone knows how to solve it?