Formatter: Insert new line before/after type alias
#KT-20766 Fixed
This commit is contained in:
@@ -98,6 +98,7 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
|
||||
inPosition(left = PROPERTY, right = FUN).emptyLinesIfLineBreakInLeft(1)
|
||||
inPosition(left = FUN, right = PROPERTY).emptyLinesIfLineBreakInLeft(1)
|
||||
inPosition(left = SECONDARY_CONSTRUCTOR, right = SECONDARY_CONSTRUCTOR).emptyLinesIfLineBreakInLeft(1)
|
||||
inPosition(left = TYPEALIAS, right = TYPEALIAS).emptyLinesIfLineBreakInLeft(1)
|
||||
|
||||
// Case left for alternative constructors
|
||||
inPosition(left = FUN, right = CLASS).emptyLinesIfLineBreakInLeft(1)
|
||||
@@ -179,6 +180,9 @@ fun createSpacingBuilder(settings: CodeStyleSettings, builderUtil: KotlinSpacing
|
||||
between(SECONDARY_CONSTRUCTOR, DECLARATIONS).blankLines(1)
|
||||
between(CLASS_INITIALIZER, DECLARATIONS).blankLines(1)
|
||||
|
||||
// TYPEALIAS - TYPEALIAS is an exception
|
||||
between(TYPEALIAS, DECLARATIONS).blankLines(1)
|
||||
|
||||
// ENUM_ENTRY - ENUM_ENTRY is exception
|
||||
between(ENUM_ENTRY, DECLARATIONS).blankLines(1)
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
typealias A = Int
|
||||
typealias B = Int
|
||||
//
|
||||
typealias C = Int
|
||||
|
||||
typealias D =
|
||||
Int
|
||||
|
||||
//
|
||||
typealias E =
|
||||
Int
|
||||
|
||||
typealias F = Int
|
||||
//
|
||||
typealias G = Int
|
||||
|
||||
class X
|
||||
//
|
||||
typealias H = Int
|
||||
|
||||
object O
|
||||
//
|
||||
typealias I = Int
|
||||
|
||||
fun foo() {}
|
||||
//
|
||||
fun foo() {}
|
||||
typealias J = Int
|
||||
|
||||
//
|
||||
class Y
|
||||
typealias K = Int
|
||||
|
||||
//
|
||||
object OO
|
||||
typealias L = Int
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
typealias A = Int
|
||||
typealias B = Int
|
||||
//
|
||||
typealias C = Int
|
||||
typealias D =
|
||||
Int
|
||||
//
|
||||
typealias E =
|
||||
Int
|
||||
typealias F = Int
|
||||
//
|
||||
typealias G = Int
|
||||
class X
|
||||
//
|
||||
typealias H = Int
|
||||
object O
|
||||
//
|
||||
typealias I = Int
|
||||
fun foo() {}
|
||||
//
|
||||
fun foo() {}
|
||||
typealias J = Int
|
||||
//
|
||||
class Y
|
||||
typealias K = Int
|
||||
//
|
||||
object OO
|
||||
typealias L = Int
|
||||
@@ -812,6 +812,12 @@ public class FormatterTestGenerated extends AbstractFormatterTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAliasSpacing.after.kt")
|
||||
public void testTypeAliasSpacing() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/TypeAliasSpacing.after.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("UnnecessarySpacesInParametersLists.after.kt")
|
||||
public void testUnnecessarySpacesInParametersLists() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/formatter/UnnecessarySpacesInParametersLists.after.kt");
|
||||
|
||||
Reference in New Issue
Block a user