nishtahir / language-kotlin

Textmate language grammar for the Kotlin programming language
Apache License 2.0
12 stars 6 forks source link

Kotlin highlight is broken when @ is used inside formatter ${} #12

Closed sanyarnd closed 4 years ago

sanyarnd commented 5 years ago

There is an issue with the following valid pattern ${this@Anything}

Example snippet:

package some.package

import java.net.InetAddress
import java.net.InetSocketAddress
import java.net.URLEncoder
import java.nio.ByteBuffer
import java.nio.channels.*
import java.nio.file.Files

/**
 * docstring
 */
class SomeClass(val id: Int = 1) {
    private val executor= Executors.newSingleThreadExecutor { task ->
        Thread(task).apply {
            name = "More specific name: `${this@SomeClass.id}`"
            isDaemon = true
        }
    }
    /** Comment */
    private var future: Future<*>? = null

    /**
     * docstring
     */
    val isLocked: Boolean
        get() = lock.isLocked

    /**
     * docstring
     * @return return
     */
    fun someFun(): Some = something.use { s ->
        return s.getSome()
    }
}
fmeum commented 4 years ago

The syntax highlighting also breaks when curly braces are nested inside a string template: https://github.com/android-password-store/Android-Password-Store/pull/685/files#diff-ebad56e8c0194ef95e63b0ec38d78593R86