Skip to content

Commit

Permalink
feat(printer): Add support for formatting comment nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Jul 29, 2024
1 parent 237df0e commit d30e09a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Printer struct {
Bool PrintFunc
String PrintFunc
Number PrintFunc
Comment PrintFunc
}

func defaultLineNumberFormat(num int) string {
Expand Down Expand Up @@ -82,6 +83,11 @@ func (p *Printer) property(tk *token.Token) *Property {
return p.Number()
}
return prop
case token.CommentType:
if p.Comment != nil {
return p.Comment()
}
return prop
default:
}
return prop
Expand Down

0 comments on commit d30e09a

Please sign in to comment.