Is it possible to attach comments to code generated by a ppx?
I’d like to include a comment on types produced by my preprocessor (which will show up when hovering in VSCode) directing users towards the ppx documentation . I realise that comments are not part of the AST but wondered if there was a workaround
Thanks,
Michael
You could attach documentation comments which are parts of the ASTs (and can be seen by documentation tools).
3 Likes
Ah, is this [@@ocaml.doc ...]
? I hadn’t realised comments were converted to attributes in this way
Yes, they’re attributes with a ocaml.doc
name. This is the equivalent of doc-comments (** ... *)
. Normal comments (* ... *)
are not part of the AST.
2 Likes