1

I'm trying to use gradle-script-kotlin to automate a complicated build process, using IntelliJ as an editor. Following the advice found in a previous question, a colleague has gotten proper syntax highlighting in the build.gradle.kts file, however, because of its complexity, I'm trying to split it up into a number of smaller files using the apply from example:

apply { 
    for (script in otherKotlinScripts)
        from("buildscripts/$script.kts") 
} 

Alas, the completion only seems to actually work on build.gradle.kts. On other kotlin-script files, free functions and anything that I import work just fine, but gradle-specific things such as this task closure:

task("foo") {
    // intelliJ can't seem to figure out what the receiver is here,
    // task itself gets highlighted in red, and its members fail
    // to complete.
}

Is there a way to allow intellij to detect included files as gradle scripts?

Dan
  • 4,312
  • 16
  • 28

1 Answers1

1

It turns out that I wasn't using the correct filenames. The current version of the kotlin intellij plugin at time of writing seems to complete correctly any file that ends with .gradle.kts. My included files just had a .kts extension without the .gradle.

Dan
  • 4,312
  • 16
  • 28