hclwrite: No spaces before ... marker in argument lists or for exprs
This commit is contained in:
parent
d1ed8ee699
commit
4b22149b7c
@ -248,8 +248,8 @@ func spaceAfterToken(subject, before, after *Token) bool {
|
|||||||
// Don't use spaces around attribute access dots
|
// Don't use spaces around attribute access dots
|
||||||
return false
|
return false
|
||||||
|
|
||||||
case after.Type == hclsyntax.TokenComma:
|
case after.Type == hclsyntax.TokenComma || after.Type == hclsyntax.TokenEllipsis:
|
||||||
// No space right before a comma in an argument list
|
// No space right before a comma or ... in an argument list
|
||||||
return false
|
return false
|
||||||
|
|
||||||
case subject.Type == hclsyntax.TokenComma:
|
case subject.Type == hclsyntax.TokenComma:
|
||||||
|
@ -63,6 +63,10 @@ func TestFormat(t *testing.T) {
|
|||||||
`foo(1, -2,a*b, b,c)`,
|
`foo(1, -2,a*b, b,c)`,
|
||||||
`foo(1, -2, a * b, b, c)`,
|
`foo(1, -2, a * b, b, c)`,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
`foo(a,b...)`,
|
||||||
|
`foo(a, b...)`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
`a="hello ${ name }"`,
|
`a="hello ${ name }"`,
|
||||||
`a = "hello ${name}"`,
|
`a = "hello ${name}"`,
|
||||||
|
Loading…
Reference in New Issue
Block a user