diff --git a/idea/src/org/jetbrains/kotlin/idea/editor/KotlinTypedHandler.java b/idea/src/org/jetbrains/kotlin/idea/editor/KotlinTypedHandler.java index a1ce03cad3c..1500514f191 100644 --- a/idea/src/org/jetbrains/kotlin/idea/editor/KotlinTypedHandler.java +++ b/idea/src/org/jetbrains/kotlin/idea/editor/KotlinTypedHandler.java @@ -249,7 +249,15 @@ public class KotlinTypedHandler extends TypedHandlerDelegate { return Result.STOP; } } - + else if (c == '|') { + if (autoIndentCase(editor, project, file, KtOperationReferenceExpression.class)) { + return Result.STOP; + } + } else if (c == '&') { + if (autoIndentCase(editor, project, file, KtOperationReferenceExpression.class)) { + return Result.STOP; + } + } return Result.CONTINUE; } diff --git a/idea/tests/org/jetbrains/kotlin/idea/editor/TypedHandlerTest.kt b/idea/tests/org/jetbrains/kotlin/idea/editor/TypedHandlerTest.kt index 7d415247b27..50a76564ee9 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/editor/TypedHandlerTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/editor/TypedHandlerTest.kt @@ -604,6 +604,42 @@ class TypedHandlerTest : LightCodeInsightTestCase() { ) } + fun testContinueWithOr() { + doCharTypeTest( + '|', + """ + |fun some() { + | if (true + | |) + |} + """, + """ + |fun some() { + | if (true + | ||) + |} + """ + ) + } + + fun testContinueWithAnd() { + doCharTypeTest( + '&', + """ + |fun some() { + | val test = true + | & + |} + """, + """ + |fun some() { + | val test = true + | && + |} + """ + ) + } + fun testSpaceAroundRange() { doCharTypeTest( '.',