KT-33384 Intention to switch between single-line/multi-line lambda (#2790)
Add intention for single-line lambda <-> multi-line lambda conversion #KT-33384 Fixed
This commit is contained in:
committed by
GitHub
parent
f94d026e64
commit
ebe3619251
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.intentions.ConvertLambdaToSingleLineIntention
|
||||
@@ -0,0 +1,7 @@
|
||||
// IS_APPLICABLE: false
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach { item ->
|
||||
println(item) // comment
|
||||
}<caret>
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// IS_APPLICABLE: false
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach { item ->
|
||||
println(item)
|
||||
println(item)
|
||||
}<caret>
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach { item ->
|
||||
|
||||
|
||||
println(item) /* comment */
|
||||
|
||||
|
||||
}<caret>
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach { item -> println(item) /* comment */ }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach {
|
||||
item ->
|
||||
println(item)
|
||||
}<caret>
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach { item -> println(item) }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach <caret>{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach { }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach {
|
||||
<caret>println(it)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach { println(it) }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach { item ->
|
||||
println(item)<caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach { item -> println(item) }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach { item ->
|
||||
println(item); println(item); println(item) /* comment */
|
||||
}<caret>
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach { item -> println(item); println(item); println(item) /* comment */ }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEachIndexed { index, s ->
|
||||
println(index)
|
||||
}<caret>
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEachIndexed { index, s -> println(index) }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<Pair<String, Int>>) {
|
||||
list.forEach { (s, _) ->
|
||||
println(s)
|
||||
}<caret>
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<Pair<String, Int>>) {
|
||||
list.forEach { (s, _) -> println(s) }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
// WITH_RUNTIME
|
||||
fun test(list: List<String>) {
|
||||
list.forEach { println(it) }
|
||||
}<caret>
|
||||
Reference in New Issue
Block a user