Skip to content

Commit

Permalink
Fix Preservation of Opening Comments
Browse files Browse the repository at this point in the history
Use Visitor.visitRule to visit CompilationUnit node so comments at the
beginning of the file are preserved.
  • Loading branch information
cwarden committed Dec 5, 2023
1 parent 34a230e commit 218bb18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion formatter/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (f *Formatter) Format() error {
// p.AddErrorListener(antlr.NewDiagnosticErrorListener(false))

v := NewVisitor(stream)
out, ok := p.CompilationUnit().Accept(v).(string)
out, ok := v.visitRule(p.CompilationUnit()).(string)
if !ok {
return fmt.Errorf("Unexpected result parsing apex")
}
Expand Down

0 comments on commit 218bb18

Please sign in to comment.