Fixed Join LInes on a block when there is a space in the end of line
This commit is contained in:
@@ -30,7 +30,10 @@ public class JoinBlockIntoSingleStatementHandler : JoinRawLinesHandlerDelegate {
|
||||
if (file !is JetFile) return -1
|
||||
|
||||
if (start == 0) return -1
|
||||
val brace = file.findElementAt(start - 1)!!
|
||||
val c = document.getCharsSequence()[start]
|
||||
val index = if (c == '\n') start - 1 else start
|
||||
|
||||
val brace = file.findElementAt(index)!!
|
||||
if (brace.getNode()!!.getElementType() != JetTokens.LBRACE) return -1
|
||||
|
||||
val block = brace.getParent() as? JetBlockExpression ?: return -1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fun foo() {
|
||||
<caret>if (a) {
|
||||
if (a) { <caret>
|
||||
bar()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
fun foo(p: Int) {
|
||||
when (p) {
|
||||
1 -> {<caret>
|
||||
1 -> { <caret>
|
||||
println()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user