I’m trying to make a plugin to add a custom script definition to IDEA. I’ve managed to make a script definition show up without any plugins if I have the project that contains the script definition loaded, but I’d like a more permanent solution. Right now I have the script definition
package dev.fishies.cohoplugin
import kotlin.script.experimental.annotations.KotlinScript
import kotlin.script.experimental.api.ScriptAcceptedLocation
import kotlin.script.experimental.api.ScriptCompilationConfiguration
import kotlin.script.experimental.api.acceptedLocations
import kotlin.script.experimental.api.ide
import kotlin.script.experimental.jvm.dependenciesFromCurrentContext
import kotlin.script.experimental.jvm.jvm
@KotlinScript(
displayName = "Coho script", fileExtension = "coho.kts", compilationConfiguration = CohoScriptConfiguration::class
)
abstract class CohoScript
object CohoScriptConfiguration : ScriptCompilationConfiguration({
jvm {
dependenciesFromCurrentContext(wholeClasspath = true)
}
ide {
acceptedLocations(ScriptAcceptedLocation.Everywhere)
}
})
and I also have put an empty file named dev.fishies.cohoplugin.CohoScript.classname
in src/main/resources/META-INF/kotlin/script/templates/
, but alas, it doesn’t show up in the IDE even when I have the plugin loaded:
It does, however, show up in the IDE window where I’m developing the plugin:
What am I doing wrong? Do the plugins not get automatically added to the classpath of the editor or something?
You can find the source code for the plugin here ↓
Also, looking towards the future, I’d like this script definition to inherit the classpath of another project of mine (coho), but right now I just want literally anything to work.