Skip to content

Commit dc09990

Browse files
committed
[formatting] fix else statement formatting
1 parent 0f610e9 commit dc09990

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

src/com/goide/formatter/GoFormattingModelBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ private static SpacingBuilder createSpacingBuilder(@NotNull CodeStyleSettings se
8787
.after(FOR).spaces(1)
8888
.after(IF).spaces(1)
8989
.after(ELSE).spaces(1)
90+
.before(ELSE_STATEMENT).spaces(1)
9091
.after(CASE).spaces(1)
9192
.after(RANGE).spaces(1)
9293
.after(SWITCH).spaces(1)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package bar
2+
3+
func main() {
4+
if (true) {
5+
6+
} else {
7+
true
8+
}
9+
10+
if {} else {}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package bar
2+
3+
func main() {
4+
if (true) {
5+
6+
}else{
7+
true
8+
}
9+
10+
if {} else {}
11+
}

tests/com/goide/formatter/GoFormatterTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ protected String getBasePath() {
4040
public void testVarDeclaration() { doTest(); }
4141
public void testBreakLines() { doTest(); }
4242
public void testCommentIndentation() { doTest(); }
43+
public void testElseStatement() { doTest(); }
4344

4445
private void doTest() { doTest(null); }
4546

0 commit comments

Comments
 (0)