Java to Kotlin converter: keep more than one blank line from original code

This commit is contained in:
Valentin Kipyatkov
2014-06-25 18:25:39 +04:00
parent 5a5e553367
commit b7bcb0d9e3
6 changed files with 7 additions and 1 deletions
+2 -1
View File
@@ -108,7 +108,8 @@ class CodeBuilder(private val topElement: PsiElement?) {
for (i in prefixElements.indices) { for (i in prefixElements.indices) {
val e = prefixElements[i] val e = prefixElements[i]
if (i == 0 && e is PsiWhiteSpace) { if (i == 0 && e is PsiWhiteSpace) {
if (e.newLinesCount() > 1) { // insert at maximum one blank line val blankLines = e.newLinesCount() - 1
for (_ in 1..blankLines) {
append("\n", false) append("\n", false)
} }
} }
@@ -3,6 +3,7 @@ class F {
fun f1() { fun f1() {
} }
fun f2() { fun f2() {
} }
var i: Int? = 0 var i: Int? = 0
@@ -7,6 +7,7 @@ class F {
fun f1() { fun f1() {
} }
//c3 //c3
@@ -1,5 +1,6 @@
class F { class F {
//c3 //c3
@@ -8,6 +8,7 @@ class F {
fun f1() { fun f1() {
} }
//c3 //c3
+1
View File
@@ -9,6 +9,7 @@ public class Language(protected var code: String) : Serializable {
} }
} }
class Base { class Base {
fun test() { fun test() {
} }