Skip to content

Commit af33ebb

Browse files
committed
[formatting] add space between empty statements inside for clause
1 parent dc09990 commit af33ebb

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

src/com/goide/formatter/GoFormattingModelBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ private static SpacingBuilder createSpacingBuilder(@NotNull CodeStyleSettings se
4646
return new SpacingBuilder(settings, GoLanguage.INSTANCE)
4747
.before(COMMA).spaceIf(false)
4848
.after(COMMA).spaceIf(true)
49+
.betweenInside(SEMICOLON, SEMICOLON, FOR_CLAUSE).spaces(1)
4950
.before(SEMICOLON).spaceIf(false)
5051
.after(SEMICOLON).spaceIf(true)
5152
.beforeInside(DOT, IMPORT_SPEC).none()
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package bar
2+
3+
func main() {
4+
for position, positionReported := 0, false; ; position++ {
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package bar
2+
3+
func main() {
4+
for position,positionReported := 0,false;;position++ {
5+
}
6+
}

tests/com/goide/formatter/GoFormatterTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ protected String getBasePath() {
4141
public void testBreakLines() { doTest(); }
4242
public void testCommentIndentation() { doTest(); }
4343
public void testElseStatement() { doTest(); }
44+
public void testEmptyStatementInForClause() { doTest(); }
4445

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

0 commit comments

Comments
 (0)