hclwrite: Formatter to put spaces before colons
The symmetrical spaces around colons in conditionals are important for familiarity with C-like languages, so we'll instead accept spaces around colons in our HCL2-unique "for expression" construct.
This commit is contained in:
parent
4c4fdbdcc0
commit
dac4796ca1
@ -316,10 +316,6 @@ func spaceAfterToken(subject, before, after *Token) bool {
|
||||
}
|
||||
return true
|
||||
|
||||
case after.Type == hclsyntax.TokenColon:
|
||||
// Never spaces before colons
|
||||
return false
|
||||
|
||||
// In the unlikely event that an interpolation expression is just
|
||||
// a single object constructor, we'll put a space between the ${ and
|
||||
// the following { to make this more obvious, and then the same
|
||||
|
@ -107,17 +107,21 @@ foo(
|
||||
)
|
||||
`,
|
||||
},
|
||||
{
|
||||
`a?b:c`,
|
||||
`a ? b : c`,
|
||||
},
|
||||
{
|
||||
`[ [ ] ]`,
|
||||
`[[]]`,
|
||||
},
|
||||
{
|
||||
`[for x in y: x]`,
|
||||
`[for x in y: x]`,
|
||||
`[for x in y : x]`,
|
||||
`[for x in y : x]`,
|
||||
},
|
||||
{
|
||||
`[for x in [y]: x]`,
|
||||
`[for x in [y]: x]`,
|
||||
`[for x in [y] : x]`,
|
||||
`[for x in [y] : x]`,
|
||||
},
|
||||
{
|
||||
`
|
||||
|
Loading…
Reference in New Issue
Block a user