I'm writing some tests for a Kotlin Gradle plugin ...
# intellij
I'm writing some tests for a Kotlin Gradle plugin using Gradle TestKit. I'm writing
files using multiline strings, and I'd like to use IntelliJ Language Injection so it looks pretty. I've set
, however, IntelliJ doesn't like it and shows an error. Is there a way of telling the language injection to highlight a string as if it were a
Copy code
fun File.`build gradle kts`(@Language("kotlin") contents: String): File =
    createFile("build.gradle.kts", contents)
kotlin != Gradle Kotlin DSL; without knowledge of the Gradle specifics (APIs / DSL), IntelliJ will only be able to get partway there. From the screenshot it looks like it’s complaining about now knowing what
is - rightfully so, cuz that is provided by Gradle. Perhaps there is a Language that is specific to Gradle Kotlin DSL build scripts? (not familiar with this aspect of IntelliJ)
There's no Gradle, kts, Kotlin Script in the list of options that are shown in the GUI
looks like you’re stuck with Kotlin, or could consider creating a custom language injection.
I don't think custom language injection exists I'm going to try defining the Gradle project in a test/resources directory. Then I can use IntelliJ to edit the files, which should be a bit nicer than a string
👍 1
gets the result I want 👍
🌟 1