Skip to content

Commit

Permalink
feat(printer): Add support for formatting comment nodes (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 authored Oct 28, 2024
1 parent e77cb4d commit 76e8f60
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 @@ -30,6 +30,7 @@ type Printer struct {
Bool PrintFunc
String PrintFunc
Number PrintFunc
Comment PrintFunc
}

func defaultLineNumberFormat(num int) string {
Expand Down Expand Up @@ -83,6 +84,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 76e8f60

Please sign in to comment.