IntelliJ Language Injection for the annotation strings


#1

Currently IntelliJ support Language Injection for SQL and JPAQL in Java classes and especially in annotations like NamedQuery which is a very handy feature to read and validate SQL and JPAQL codes right inside Java.

Unfortunately IntelliJ supports language injection for Kotlin language partially and we can’t use this feature in Kotlin annotations.

There is a workaround for this problem by using // language=JPAQL comment above your annotation. But the problem is, all other strings after the annotation will be treated as JPAQL language as well, which will cause many IDE errors in Kotlin file.

The IntelliJ rules for language injections is in Preferences=>Editor=>Language Injections path. Is there a way to define a rule to support language injection for Kotlin annotations strings? Or we must wait to support this feature by future Kotlin Plugin releases.