Make line break before '}' optional

#KT-6142 Fixed
This commit is contained in:
Nikolay Krasko
2014-10-27 12:26:25 +04:00
parent 0cd95b5514
commit d1fe9b71ef
5 changed files with 71 additions and 5 deletions
@@ -290,11 +290,12 @@ fun createSpacingBuilder(settings: CodeStyleSettings): KotlinSpacingBuilder {
Spacing.createSpacing(numSpaces, numSpaces, 0, settings.KEEP_LINE_BREAKS, settings.KEEP_BLANK_LINES_IN_CODE)
}
inPosition(parent = CLASS_BODY, right = RBRACE).lineBreakIfLineBreakInParent(numSpacesOtherwise = 1)
}
simple {
afterInside(LBRACE, BLOCK).lineBreakInCode()
beforeInside(RBRACE, CLASS_BODY).lineBreakInCode()
beforeInside(RBRACE, BLOCK).lineBreakInCode()
beforeInside(RBRACE, WHEN).lineBreakInCode()
between(RPAR, BODY).spaces(1)
@@ -1,5 +1,4 @@
enum class E1 { F S T
}
enum class E1 { F S T }
enum class E2 {
F S T
@@ -15,8 +14,7 @@ enum class E4 {
S T
}
enum class E5 { F S {} T
}
enum class E5 { F S {} T }
enum class E6 {
F S T {}
@@ -0,0 +1,34 @@
enum class E1 { F S T }
enum class E2 { F S T }
enum class E3 {
F S T
}
class C1 {}
class C2 {
fun test() {
}
}
object O1 {}
object O2 {
fun test() {
}
}
trait T1 {}
trait T2 {
val some = 1
}
enum class E1 {
EE1 {}
EE2 {
val some = 1
}
}
@@ -0,0 +1,27 @@
enum class E1 { F S T }
enum class E2 { F S T}
enum class E3 {
F S T}
class C1 {}
class C2 {
fun test() {}}
object O1 {}
object O2 {
fun test() {}}
trait T1 {}
trait T2 {
val some = 1}
enum class E1 {
EE1 {}
EE2 {
val some = 1}
}
@@ -328,6 +328,12 @@ public class JetFormatterTestGenerated extends AbstractJetFormatterTest {
doTest(fileName);
}
@TestMetadata("NewLineForRBrace.after.kt")
public void testNewLineForRBrace() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/formatter/NewLineForRBrace.after.kt");
doTest(fileName);
}
@TestMetadata("Parameters.after.kt")
public void testParameters() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/formatter/Parameters.after.kt");