Introduce intention: trimMargin <--> trimIndent #KT-25056 Fixed

This commit is contained in:
Toshiaki Kameyama
2018-07-03 21:22:18 +09:00
committed by Nikolay Krasko
parent df6d4f358a
commit 9e83506c02
37 changed files with 496 additions and 0 deletions
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.ConvertTrimIndentToTrimMarginIntention
@@ -0,0 +1,9 @@
// WITH_RUNTIME
fun test() {
val x =
"""
a
b
c
""".<caret>trimIndent()
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
fun test() {
val x =
"""
|a
| b
| c
""".trimMargin()
}
@@ -0,0 +1,9 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun test() {
val x =
"""1
a
b
""".<caret>trimIndent()
}
@@ -0,0 +1,9 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun test() {
val x =
"""
a
b
1""".<caret>trimIndent()
}
@@ -0,0 +1,5 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun test() {
val x = " a".<caret>trimIndent()
}
@@ -0,0 +1,10 @@
// INTENTION_TEXT: "Convert to 'trimMargin'"
// WITH_RUNTIME
fun test() {
val x =
"""
a
b
""".<caret>trimIndent()
}
@@ -0,0 +1,10 @@
// INTENTION_TEXT: "Convert to 'trimMargin'"
// WITH_RUNTIME
fun test() {
val x =
"""
|a
|b
""".trimMargin()
}
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.intentions.ConvertTrimMarginToTrimIndentIntention
@@ -0,0 +1,9 @@
// WITH_RUNTIME
fun test() {
val x =
"""
|a
| b
|c
""".<caret>trimMargin()
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
fun test() {
val x =
"""
a
b
c
""".trimIndent()
}
@@ -0,0 +1,9 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun test() {
val x =
"""
\a
\b
""".<caret>trimMargin("\\")
}
@@ -0,0 +1,9 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun test() {
val x =
"""
|a
b
""".<caret>trimMargin()
}
@@ -0,0 +1,9 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun test() {
val x =
"""1
|a
|b
""".<caret>trimMargin()
}
@@ -0,0 +1,9 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun test() {
val x =
"""
|a
|b
1"""<caret>.trimMargin()
}
@@ -0,0 +1,5 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun test() {
val x = " |a".<caret>trimMargin()
}
@@ -0,0 +1,9 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun test(marginPrefix: String) {
val x =
"""
|a
|b
""".<caret>trimMargin(marginPrefix)
}
@@ -0,0 +1,9 @@
// INTENTION_TEXT: "Convert to 'trimIndent'"
// WITH_RUNTIME
fun test() {
val x =
"""
|a
|b
""".<caret>trimMargin()
}
@@ -0,0 +1,9 @@
// INTENTION_TEXT: "Convert to 'trimIndent'"
// WITH_RUNTIME
fun test() {
val x =
"""
a
b
""".trimIndent()
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
fun test() {
val x =
"""
#a
#b
""".<caret>trimMargin("#")
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
fun test() {
val x =
"""
a
b
""".trimIndent()
}