Support prefix and suffix in Kotlin injection with comments and annotations (KT-23005)

#KT-23005 Fixed
This commit is contained in:
Nikolay Krasko
2018-02-22 20:50:25 +03:00
parent 9026582352
commit 4c7e46cbf8
4 changed files with 80 additions and 32 deletions
@@ -416,6 +416,24 @@ class KotlinInjectionTest : AbstractInjectionTest() {
)
)
fun testSuffixPrefixWithAnnotation() = doInjectionPresentTest(
"""
@org.intellij.lang.annotations.Language("TEXT", prefix = "abc", suffix = "ghi")
val test = "<caret>def"
""",
languageId = PlainTextLanguage.INSTANCE.id, unInjectShouldBePresent = false,
shreds = listOf(ShredInfo(range(0, 9), hostRange=range(1, 4), prefix = "abc", suffix = "ghi"))
)
fun testSuffixPrefixInComment() = doInjectionPresentTest(
"""
// language="TEXT" prefix="abc" suffix=ghi
val test = "<caret>def"
""",
languageId = PlainTextLanguage.INSTANCE.id, unInjectShouldBePresent = false,
shreds = listOf(ShredInfo(range(0, 9), hostRange=range(1, 4), prefix = "abc", suffix = "ghi"))
)
fun testJavaAnnotationsPattern() {
myFixture.addClass("""
@interface Matches { String value(); }