Hi! Thanks for all the hard work on Forester :-)
Pp_code aims to print the AST (Code.t) in such a way that parsing, printing and reparsing returns the same AST.
This is a much more complete version of what Graft has coded up which may be useful to other users of Forester's API.
The new test/roundtrip roundtrips all of the trees in docs/trees using the new Code.equal function to compare the first and second parses. Small disclaimer, I am not a very confident Formater, I'm sure there is plenty we could do to improve the output, but this is perhaps an ok first pass.
Comments
did:plc:jjiv56ot7d6sgethto3jr3r5
This looks like a good idea. @kento.tngl.sh, are you fine with this?
did:plc:4gj3ihsdh6fn3aqq5bdnw5w3
Yes, thanks a lot! Interested in wiring this up to the lsp for autoformatting, as an opt-in feature.
did:plc:vbqt7s7rrltkvlvwavk5ypkf
Thanks both!
We may need a little more work on the formatting to make it closer to an opt-in formatting tool, but happy to see this merged and when forester.6.0.0 lands I can release a complementary graft version that can make use of this.