Any idea (no puh intended) what I can do if IDEA i...
# scripting
s
Any idea (no puh intended) what I can do if IDEA is not showing my custom script definitions (that are part of the current project) in the settings? See
It used to show my own "rules.kts" script extension, but now it doesn't anymore. I've updated a bunch of dependencies since then (Gradle 8.5, Kotlin 1.9.21), could that play a role?
Ah, subtle, the status bar shows > No script runtime was found in the classpath: class 'kotlin.script.templates.standard.ScriptTemplateWithArgs' not found. Please add kotlin-script-runtime.jar to the module dependencies. Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly. I need to find out what that means.
I have dependencies on these, which I thought would suffice:
Copy code
implementation("org.jetbrains.kotlin:kotlin-scripting-common")
    implementation("org.jetbrains.kotlin:kotlin-scripting-jvm-host")
d
I found that if IDEA has an error while loading the project, it will just silently swallow it and won't try to reload the script template without restarting. You can see these types of errors in he Idea.log (
Show log
from the
Help
menu).
After you solve the problem in that log, restart IntelliJ, and it should pick it up.
i
Just in case, you can try disabling this Registry flag (in 23.3) kotlin.scripting.load.definitions.on.demand There is a known regression that may prevent custom script definitions from loading
👍🏻 1
s
Thanks @Ilya Muradyan, disabling that flag indeed did fix the issue!
If it's known, is there an issue I can track for the fix?
i
Sure: https://youtrack.jetbrains.com/issue/KTIJ-27995 The fix is ready and should be backported to 2023.3.1
👍🏻 1
s
Ah, it has already been fixed (though not released yet), great!