From 8f9b818e439797e2d2457faaf2eef18f1ffa2372 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Sun, 4 Feb 2018 11:04:22 +0100 Subject: [PATCH] Do not indent closing bracket of array access expression #KT-22641 Fixed --- .../jetbrains/kotlin/idea/formatter/KotlinCommonBlock.kt | 1 + idea/testData/formatter/ArrayAccess.after.kt | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonBlock.kt b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonBlock.kt index 443f376c57d..e3c9c08de56 100644 --- a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonBlock.kt +++ b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonBlock.kt @@ -723,6 +723,7 @@ private val INDENT_RULES = arrayOf( strategy("Indices") .within(KtNodeTypes.INDICES) + .notForType(KtTokens.RBRACKET) .set(Indent.getContinuationIndent(false)), strategy("Binary expressions") diff --git a/idea/testData/formatter/ArrayAccess.after.kt b/idea/testData/formatter/ArrayAccess.after.kt index 84ee17c9fd7..9f74d754037 100644 --- a/idea/testData/formatter/ArrayAccess.after.kt +++ b/idea/testData/formatter/ArrayAccess.after.kt @@ -6,13 +6,13 @@ fun test() { a[ 1, 2 - ] + ] a[ 1, 2 - ] + ] a[ @@ -20,5 +20,5 @@ fun test() { 1, 2 - ] + ] } \ No newline at end of file