Skip to content

Commit

Permalink
[formatting] add space between empty statements inside for clause
Browse files Browse the repository at this point in the history
  • Loading branch information
zolotov committed Mar 28, 2016
1 parent dc09990 commit af33ebb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/com/goide/formatter/GoFormattingModelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ private static SpacingBuilder createSpacingBuilder(@NotNull CodeStyleSettings se
return new SpacingBuilder(settings, GoLanguage.INSTANCE)
.before(COMMA).spaceIf(false)
.after(COMMA).spaceIf(true)
.betweenInside(SEMICOLON, SEMICOLON, FOR_CLAUSE).spaces(1)
.before(SEMICOLON).spaceIf(false)
.after(SEMICOLON).spaceIf(true)
.beforeInside(DOT, IMPORT_SPEC).none()
Expand Down
6 changes: 6 additions & 0 deletions testData/formatting/emptyStatementInForClause-after.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package bar

func main() {
for position, positionReported := 0, false; ; position++ {
}
}
6 changes: 6 additions & 0 deletions testData/formatting/emptyStatementInForClause.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package bar

func main() {
for position,positionReported := 0,false;;position++ {
}
}
1 change: 1 addition & 0 deletions tests/com/goide/formatter/GoFormatterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ protected String getBasePath() {
public void testBreakLines() { doTest(); }
public void testCommentIndentation() { doTest(); }
public void testElseStatement() { doTest(); }
public void testEmptyStatementInForClause() { doTest(); }

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

Expand Down

0 comments on commit af33ebb

Please sign in to comment.