When to if now add braces for if branches inside #KT-12942 Fixed
(cherry picked from commit 29a7bfe)
This commit is contained in:
committed by
Mikhail Glukhikh
parent
b675b49daf
commit
3fe114fc24
+7
@@ -22,6 +22,7 @@ import com.intellij.openapi.util.TextRange
|
||||
import org.jetbrains.kotlin.idea.intentions.SelfTargetingRangeIntention
|
||||
import org.jetbrains.kotlin.idea.intentions.branchedTransformations.combineWhenConditions
|
||||
import org.jetbrains.kotlin.idea.util.CommentSaver
|
||||
import org.jetbrains.kotlin.psi.KtIfExpression
|
||||
import org.jetbrains.kotlin.psi.KtPsiFactory
|
||||
import org.jetbrains.kotlin.psi.KtWhenExpression
|
||||
import org.jetbrains.kotlin.psi.buildExpression
|
||||
@@ -54,7 +55,13 @@ class WhenToIfIntention : SelfTargetingRangeIntention<KtWhenExpression>(KtWhenEx
|
||||
appendFixedText("if (")
|
||||
appendExpression(condition)
|
||||
appendFixedText(")")
|
||||
if (branch is KtIfExpression) {
|
||||
appendFixedText("{ ")
|
||||
}
|
||||
appendExpression(branch)
|
||||
if (branch is KtIfExpression) {
|
||||
appendFixedText(" }")
|
||||
}
|
||||
}
|
||||
if (i != entries.lastIndex) {
|
||||
appendFixedText("\n")
|
||||
|
||||
Reference in New Issue
Block a user