Rescript-compiler: Convert belt comment doc examples to rescript syntax

Created on 14 Dec 2020  路  6Comments  路  Source: rescript-lang/rescript-compiler

They are currently written in ml syntax.
Another approach would be converting them in rescript-editor-support's dump command (since main use case is hover IMO).
I think we eventually need to convert belt itself to rescript syntax. examples can be converted at that moment too, what do you think?

Edit: Screenshot (this is so weired for newcomers to see ml examples)
image

All 6 comments

cc @ryyppy
In the short term, we can do the conversion on the fly
In the long term, we should switch to the rescript syntax ( there may be issues with ocaml stdlib)

Not sure how hard it would be to parse examples from the strings to convert them on the fly. We wanted to add the rescript syntax to the editor-support to be able to do proper parsing / printing of signatures.. so this might be the first step to do on the fly conversion?

Did an experiment using res_multi_printer of rescript-syntax
image

For using this we need to vendor the whole syntax repo (in order to parse ML and convert them to Res).
Currently we only use a subset of syntax repo for printing types (outcome printer)

@amiralies can you open a tracking issue / PR to the editor-support repository? We'll probably need @cristianoc to verify the approach

Short update: The plan is to update the Belt / stdlib modules to our own markdown based doc headers. The way editor-support needs to adhocly convert different doc header formats is pretty hacky / error prone and we want to get rid of it (also for perf reasons).

More details on that plan as soon as we are happy with the state of our documentation generator (to verify our use-cases first) which is still quite WIP.

Would be happy to contribute.
Note that it would be great if we think about how we are going to keep versioned docs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tanaka-de-silva picture tanaka-de-silva  路  5Comments

bobzhang picture bobzhang  路  4Comments

bobzhang picture bobzhang  路  4Comments

alexfedoseev picture alexfedoseev  路  5Comments

bobzhang picture bobzhang  路  3Comments