From 76e8f601c1d6abb2653c3ef50a69d57999221fc0 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Sun, 27 Oct 2024 21:35:40 -0500 Subject: [PATCH] feat(printer): Add support for formatting comment nodes (#469) --- printer/printer.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/printer/printer.go b/printer/printer.go index a039322a..c7148129 100644 --- a/printer/printer.go +++ b/printer/printer.go @@ -30,6 +30,7 @@ type Printer struct { Bool PrintFunc String PrintFunc Number PrintFunc + Comment PrintFunc } func defaultLineNumberFormat(num int) string { @@ -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