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 a493d7d2ac0..9def17ce666 100644 --- a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonBlock.kt +++ b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/KotlinCommonBlock.kt @@ -367,7 +367,7 @@ abstract class KotlinCommonBlock( parentType in BINARY_EXPRESSIONS && getOperationType(node) in ALIGN_FOR_BINARY_OPERATIONS -> createAlignmentStrategy(kotlinCommonSettings.ALIGN_MULTILINE_BINARY_OPERATION, getAlignment()) - parentType === KtNodeTypes.SUPER_TYPE_LIST || parentType === KtNodeTypes.INITIALIZER_LIST -> + parentType === KtNodeTypes.SUPER_TYPE_LIST -> createAlignmentStrategy(kotlinCommonSettings.ALIGN_MULTILINE_EXTENDS_LIST, getAlignment()) parentType === KtNodeTypes.PARENTHESIZED -> @@ -765,7 +765,7 @@ private val INDENT_RULES = arrayOf( .set(Indent.getNormalIndent(false)), strategy("Delegation list") - .within(KtNodeTypes.SUPER_TYPE_LIST, KtNodeTypes.INITIALIZER_LIST) + .within(KtNodeTypes.SUPER_TYPE_LIST) .continuationIf(KotlinCodeStyleSettings::CONTINUATION_INDENT_IN_SUPERTYPE_LISTS, indentFirst = true), strategy("Indices") diff --git a/idea/testData/formatter/EnumInitializerList.after.kt b/idea/testData/formatter/EnumInitializerList.after.kt new file mode 100644 index 00000000000..4b626eb6b89 --- /dev/null +++ b/idea/testData/formatter/EnumInitializerList.after.kt @@ -0,0 +1,8 @@ +package test + +enum class EnumTest(val value: Int) { + VALUE_1 + ( + value = 0 + ) +} \ No newline at end of file diff --git a/idea/testData/formatter/EnumInitializerList.kt b/idea/testData/formatter/EnumInitializerList.kt new file mode 100644 index 00000000000..90888282ad4 --- /dev/null +++ b/idea/testData/formatter/EnumInitializerList.kt @@ -0,0 +1,8 @@ +package test + +enum class EnumTest(val value: Int) { + VALUE_1 + ( + value = 0 + ) +} \ No newline at end of file diff --git a/idea/testData/formatter/ExtendsListAlignEnum.after.inv.kt b/idea/testData/formatter/ExtendsListAlignEnum.after.inv.kt new file mode 100644 index 00000000000..40f31a1ba3c --- /dev/null +++ b/idea/testData/formatter/ExtendsListAlignEnum.after.inv.kt @@ -0,0 +1,8 @@ +// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST + +enum class EnumTest(val value: Int) { + VALUE_1( + value = 0 + ) +} + diff --git a/idea/testData/formatter/ExtendsListAlignEnum.after.kt b/idea/testData/formatter/ExtendsListAlignEnum.after.kt new file mode 100644 index 00000000000..40f31a1ba3c --- /dev/null +++ b/idea/testData/formatter/ExtendsListAlignEnum.after.kt @@ -0,0 +1,8 @@ +// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST + +enum class EnumTest(val value: Int) { + VALUE_1( + value = 0 + ) +} + diff --git a/idea/testData/formatter/ExtendsListAlignEnum.kt b/idea/testData/formatter/ExtendsListAlignEnum.kt new file mode 100644 index 00000000000..5106a58d1c1 --- /dev/null +++ b/idea/testData/formatter/ExtendsListAlignEnum.kt @@ -0,0 +1,8 @@ +// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST + +enum class EnumTest(val value: Int) { +VALUE_1( +value = 0 +) +} + diff --git a/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java b/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java index 4510f87a81b..debe4363967 100644 --- a/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/formatter/FormatterTestGenerated.java @@ -291,6 +291,11 @@ public class FormatterTestGenerated extends AbstractFormatterTest { runTest("idea/testData/formatter/EnumArguments.after.kt"); } + @TestMetadata("EnumInitializerList.after.kt") + public void testEnumInitializerList() throws Exception { + runTest("idea/testData/formatter/EnumInitializerList.after.kt"); + } + @TestMetadata("EnumWrapping.after.kt") public void testEnumWrapping() throws Exception { runTest("idea/testData/formatter/EnumWrapping.after.kt"); @@ -301,6 +306,11 @@ public class FormatterTestGenerated extends AbstractFormatterTest { runTest("idea/testData/formatter/ExpressionBodyWrap.after.kt"); } + @TestMetadata("ExtendsListAlignEnum.after.kt") + public void testExtendsListAlignEnum() throws Exception { + runTest("idea/testData/formatter/ExtendsListAlignEnum.after.kt"); + } + @TestMetadata("ExtendsListWrap.after.kt") public void testExtendsListWrap() throws Exception { runTest("idea/testData/formatter/ExtendsListWrap.after.kt"); @@ -1186,6 +1196,11 @@ public class FormatterTestGenerated extends AbstractFormatterTest { runTest("idea/testData/formatter/EmptyLineBetweenEnumEntries.after.inv.kt"); } + @TestMetadata("ExtendsListAlignEnum.after.inv.kt") + public void testExtendsListAlignEnum() throws Exception { + runTest("idea/testData/formatter/ExtendsListAlignEnum.after.inv.kt"); + } + @TestMetadata("ForLineBreak.after.inv.kt") public void testForLineBreak() throws Exception { runTest("idea/testData/formatter/ForLineBreak.after.inv.kt");