anoma / juvix

A language for intent-centric and declarative decentralised applications
https://docs.juvix.org
GNU General Public License v3.0
457 stars 53 forks source link

Non-judoc comments are removed when generating HTML output #1723

Closed lukaszcz closed 1 year ago

lukaszcz commented 1 year ago

This makes it impossible to e.g. write a comment above an import statement.

It also makes it hard to write a tutorial as a Juvix file and generate nice html output for it.

paulcadman commented 1 year ago

The same issue affects the formatter, but we have no ideas on how to fix it. https://github.com/anoma/juvix/issues/1593

janmasrovira commented 1 year ago

I have been thinking about this today. Collecting the string comments is an easy task. The hard part is printing them in the appropriate place wihtout storing them in the ast. I've been looking at the implementation of ghc's exact print for inspiration. It looks a bit hacky but I'll see what I can get out of it

paulcadman commented 1 year ago

An interesting note on GHC exact printing annotations: https://gitlab.haskell.org/ghc/ghc/-/wikis/api-annotations