Skip to content

Commit

Permalink
hclwrite: Formatter should put a space after a comma
Browse files Browse the repository at this point in the history
  • Loading branch information
apparentlymart committed Jul 14, 2018
1 parent 314ea6f commit 3c0fafd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hclwrite/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ func spaceAfterToken(subject, before, after *Token) bool {
// No space right before a comma in an argument list
return false

case subject.Type == hclsyntax.TokenComma:
// Always a space after a comma
return true

case subject.Type == hclsyntax.TokenQuotedLit || subject.Type == hclsyntax.TokenStringLit || subject.Type == hclsyntax.TokenOQuote || subject.Type == hclsyntax.TokenOHeredoc || after.Type == hclsyntax.TokenQuotedLit || after.Type == hclsyntax.TokenStringLit || after.Type == hclsyntax.TokenCQuote || after.Type == hclsyntax.TokenCHeredoc:
// No extra spaces within templates
return false
Expand Down

0 comments on commit 3c0fafd

Please sign in to comment.