Should be working out of the box if you name your file as xxx.main.kts
s
Sebastian Schuberth
12/22/2021, 12:46 PM
Well, that's the point: I have custom scripts (with a custom DSL, custom default imports etc.) so I can't / don't want to use
.main.kts
directly, but build my own.
Sebastian Schuberth
12/22/2021, 12:57 PM
In particular, I'm interesting in whether it's possible to add IDEA completion support for custom scripts without writing an IDEA plugin. The instructions in
scripting-support.md
are a bit unclear about that. It sounds as if it could also be enough to just create a
.classname
file at
META-INF/kotlin/script/templates/
and add the corresponding JAR to the compiler's classpath.
Sebastian Schuberth
12/22/2021, 3:33 PM
Looks like I was able to get it working. The main problem seemingly was that I had the script configuration (annotated with
@KotlinScript
) and the script to run in the same IntelliJ model / project JAR. Splitting out the script configuration into a separate project, and making the project containing the scripts (as resources) depend on that project solved the highlighting / auto-completion issue, which now works in IntelliJ IDEA.