easily fix KTS editor support for new IntelliJ versions
dependencies {
implementation("org.jire.ktsworkaround:script-def:1.1.0")
}import org.jire.ktsworkaround.scriptdef.KtsScriptTemplate
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.api.isStandalone
import kotlin.script.experimental.jvm.dependenciesFromClassContext
import kotlin.script.experimental.jvm.dependenciesFromCurrentContext
import kotlin.script.experimental.jvm.jvm
object ExampleCompilation : ScriptCompilationConfiguration({
isStandalone(false)
ide {
acceptedLocations(ScriptAcceptedLocation.Project)
}
jvm {
dependenciesFromCurrentContext(wholeClasspath = true)
dependenciesFromClassContext(KtsScriptTemplate::class, wholeClasspath = true)
}
}) {
private fun readResolve(): Any = ExampleCompilation
}File -> Invalidate Caches / Restart and restart the IDE, then build your Gradle project. That's it!
Please install my KTS Support plugin from the IntelliJ Marketplace to get go-to (CTRL clicking) support for your KTS scripts.