Skip to content

Jire/kts-workaround

Repository files navigation

kts-workaround

easily fix KTS editor support for new IntelliJ versions

First, add the lib to your project

dependencies {
    implementation("org.jire.ktsworkaround:script-def:1.1.0")
}

Then edit all your ScriptCompilationConfiguration bodys like this:

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
}

And finally, in IntelliJ IDEA, go to

File -> Invalidate Caches / Restart and restart the IDE, then build your Gradle project. That's it!

Go-to (CTRL clicking) Support

Please install my KTS Support plugin from the IntelliJ Marketplace to get go-to (CTRL clicking) support for your KTS scripts.

About

easily fix KTS editor support for new IntelliJ versions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages