I've implemented a custom `@KotlinScript`. Works g...
# scripting
c
I've implemented a custom
@KotlinScript
. Works great, using
BasicJvmScriptingHost
inside a command line app. I would like a good developer experience too, so I've started an IDEA plugin, using
ScriptDefinitionsProvider
which is also sort of working. Is it possible to run and debug this script in IDEA? I have no idea how to go about supplying the implicit receiver objects required by the script context. Also, is it possible to supply javadocs to the configuration?
ScriptDefinitionsProvider.getDefinitionsClassPath
suggests not. Thanks.
i
There is no support for running and debugging scripts, unfortunately, at least not yet. IntelliJ supports shebang lines, so if you can run some scripts, if your prepare the runner and environment appropriately, but this is not something out-of-the-box. (E.g. it works for .main.kts scripts, because
kotlin
runner has built-in support for it.) You can supply the implicit receiver via the evaluation configuration callback
refineConfigurationBeforeEvaluate
, and attach the evaluation configuration with the callback via the
@KotlinScript
annotation too. This way it is possible to make it work with practically any standard host. But this will not solve the first problem, unfortunately.
@Craig, sorry, I probably mislead you. There is a support from script running and debugging. At least it works for main.kts scripts, but I think it extends to any properly configured scripts in IntelliJ. You can access it by right-clicking on the script file in the project view.