diff --git a/zclwrite/format.go b/zclwrite/format.go index b9eb7e9..5f72116 100644 --- a/zclwrite/format.go +++ b/zclwrite/format.go @@ -231,6 +231,10 @@ func spaceAfterToken(subject, before, after *Token) bool { // Don't split a function name from open paren in a call return false + case subject.Type == zclsyntax.TokenDot || after.Type == zclsyntax.TokenDot: + // Don't use spaces around attribute access dots + return false + case after.Type == zclsyntax.TokenComma: // No space right before a comma in an argument list return false diff --git a/zclwrite/format_test.go b/zclwrite/format_test.go index 673f5ed..1824afb 100644 --- a/zclwrite/format_test.go +++ b/zclwrite/format_test.go @@ -23,6 +23,10 @@ func TestFormat(t *testing.T) { `a=1`, `a = 1`, }, + { + `a=b.c`, + `a = b.c`, + }, { `( a+2 )`, `(a + 2)`,