fix syntax of the key expression (#4586)

This commit is contained in:
kesonan
2025-01-18 23:46:24 +08:00
committed by GitHub
parent 3d931d7030
commit b650c8c425
9 changed files with 127 additions and 69 deletions

View File

@@ -46,7 +46,8 @@ func (a *AtServerStmt) Format(prefix ...string) string {
w.Write(withNode(atServerNode, a.LParen), expectSameLine())
w.NewLine()
for _, v := range a.Values {
node := transferTokenNode(v.Key, withTokenNodePrefix(peekOne(prefix)+Indent), ignoreLeadingComment())
node := transferNilInfixNode([]*TokenNode{v.Key, v.Colon})
node = transferTokenNode(node, withTokenNodePrefix(peekOne(prefix)+Indent), ignoreLeadingComment())
w.Write(withNode(node, v.Value), expectIndentInfix(), expectSameLine())
w.NewLine()
}
@@ -148,7 +149,8 @@ func (a *AtDocGroupStmt) Format(prefix ...string) string {
w.Write(withNode(atDocNode, a.LParen), expectSameLine())
w.NewLine()
for _, v := range a.Values {
node := transferTokenNode(v.Key, withTokenNodePrefix(peekOne(prefix)+Indent), ignoreLeadingComment())
node := transferNilInfixNode([]*TokenNode{v.Key, v.Colon})
node = transferTokenNode(node, withTokenNodePrefix(peekOne(prefix)+Indent), ignoreLeadingComment())
w.Write(withNode(node, v.Value), expectIndentInfix(), expectSameLine())
w.NewLine()
}