Option for normal indent in supertype lists
#KT-21527 Fixed
This commit is contained in:
+1
@@ -43,6 +43,7 @@ public class KotlinCodeStyleSettings extends CustomCodeStyleSettings {
|
||||
public boolean CONTINUATION_INDENT_IN_PARAMETER_LISTS = true;
|
||||
public boolean CONTINUATION_INDENT_FOR_EXPRESSION_BODIES = true;
|
||||
public boolean CONTINUATION_INDENT_FOR_CHAINED_CALLS = true;
|
||||
public boolean CONTINUATION_INDENT_IN_SUPERTYPE_LISTS = true;
|
||||
public int BLANK_LINES_AROUND_BLOCK_WHEN_BRANCHES = 0;
|
||||
|
||||
public KotlinCodeStyleSettings(CodeStyleSettings container) {
|
||||
|
||||
@@ -494,7 +494,12 @@ private val INDENT_RULES = arrayOf<NodeIndentStrategy>(
|
||||
|
||||
strategy("Delegation list")
|
||||
.within(KtNodeTypes.SUPER_TYPE_LIST, KtNodeTypes.INITIALIZER_LIST)
|
||||
.set(Indent.getContinuationIndent(false)),
|
||||
.set { settings ->
|
||||
if (settings.kotlinSettings.CONTINUATION_INDENT_IN_SUPERTYPE_LISTS)
|
||||
Indent.getContinuationIndent(false)
|
||||
else
|
||||
Indent.getNormalIndent()
|
||||
},
|
||||
|
||||
strategy("Indices")
|
||||
.within(KtNodeTypes.INDICES)
|
||||
|
||||
+5
@@ -258,6 +258,11 @@ class KotlinLanguageCodeStyleSettingsProvider : LanguageCodeStyleSettingsProvide
|
||||
showCustomOption(KotlinCodeStyleSettings::LBRACE_ON_NEXT_LINE,
|
||||
"Put left brace on new line",
|
||||
CodeStyleSettingsCustomizable.WRAPPING_BRACES)
|
||||
|
||||
showCustomOption(
|
||||
KotlinCodeStyleSettings::CONTINUATION_INDENT_IN_SUPERTYPE_LISTS,
|
||||
"Use continuation indent",
|
||||
CodeStyleSettingsCustomizable.WRAPPING_EXTENDS_LIST)
|
||||
}
|
||||
LanguageCodeStyleSettingsProvider.SettingsType.BLANK_LINES_SETTINGS -> {
|
||||
consumer.showStandardOptions(
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo :
|
||||
Bar,
|
||||
Baz
|
||||
|
||||
// SET_TRUE: CONTINUATION_INDENT_IN_SUPERTYPE_LISTS
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo :
|
||||
Bar,
|
||||
Baz
|
||||
|
||||
// SET_TRUE: CONTINUATION_INDENT_IN_SUPERTYPE_LISTS
|
||||
@@ -0,0 +1,5 @@
|
||||
class Foo :
|
||||
Bar,
|
||||
Baz
|
||||
|
||||
// SET_TRUE: CONTINUATION_INDENT_IN_SUPERTYPE_LISTS
|
||||
@@ -218,6 +218,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ContinuationIndentInSupertypeLists.after.kt")
|
||||
public void testContinuationIndentInSupertypeLists() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/ContinuationIndentInSupertypeLists.after.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("CurlyBraceStringInterpolation.after.kt")
|
||||
public void testCurlyBraceStringInterpolation() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/CurlyBraceStringInterpolation.after.kt");
|
||||
|
||||
Reference in New Issue
Block a user