JetBrains / js-graphql-intellij-plugin

GraphQL language support for WebStorm, IntelliJ IDEA and other IDEs based on the IntelliJ Platform.
https://jimkyndemeyer.github.io/js-graphql-intellij-plugin/
MIT License
879 stars 97 forks source link

Does not handle `${'$'}` in kotlin multline strings when variable is used #717

Open yanlin-yc opened 4 weeks ago

yanlin-yc commented 4 weeks ago

Before you create the issue

Describe the bug A clear and concise description of what the bug is.

It's pretty common to use multiline strings in kotlin to write a graphql document in code. When a variable is needed, the only way to make $ (dollar sign) escaped in the multiline string is using the literal representation like the following:

// language=GraphQL
val document = """
query ExampleQuery(${'$'}email: String) {
    userByEmail(email: ${'$'}email) {
        id
        email
    }
}
""".trimIdent()

However when ${'$'} appears, the GraphQL IntelliJ plugin will no longer process the document and there is no syntax highlighting or autocompletion.

If no variable used, everything works as expected, e.g. the following is fine

// language=GraphQL
val document = """
query ExampleQuery {
    userByEmail(email: test@test.com) {
        id
        email
    }
}
""".trimIdent()

To Reproduce Link to Repo with Reproduction or Steps to Reproduce: (see the above example code)

Expected behavior A clear and concise description of what you expected to happen.

The GraphQL IntelliJ plugin should be able to handle ${'$'} in kotlin multiline string as it's a very common use case.

Screenshots If applicable, add screenshots to help explain your problem.

Version and Environment Details Operation system: MacOS Sonoma Version 14.5 IDE name and version: IntelliJ IDEA 2024.1.2 (Ultimate Edition) Plugin version: 241.14494.150

Additional context Add any other context about the problem here.