Skip to content

Commit

Permalink
Honor Wrap Flag When Formatting List of SELECT Fields
Browse files Browse the repository at this point in the history
  • Loading branch information
cwarden committed Dec 9, 2023
1 parent ee63be0 commit 3a986a4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion formatter/visitors.go
Original file line number Diff line number Diff line change
Expand Up @@ -772,11 +772,15 @@ func (v *FormatVisitor) VisitFieldNameAlias(ctx *parser.FieldNameAliasContext) i
}

func (v *FormatVisitor) VisitSelectList(ctx *parser.SelectListContext) interface{} {
sep := ", "
if v.wrap {
sep = ",\n"
}
selectEntries := []string{}
for _, p := range ctx.AllSelectEntry() {
selectEntries = append(selectEntries, v.visitRule(p).(string))
}
return strings.Join(selectEntries, ",\n")
return strings.Join(selectEntries, sep)
}

func (v *FormatVisitor) VisitSubFieldList(ctx *parser.SubFieldListContext) interface{} {
Expand Down

0 comments on commit 3a986a4

Please sign in to comment.