ml-in-barcelona / jsoo-react

js_of_ocaml bindings for ReactJS. Based on ReasonReact.
https://ml-in-barcelona.github.io/jsoo-react
MIT License
138 stars 19 forks source link

Help Merlin find ast nodes inside let%component #134

Closed jchavarri closed 2 years ago

jchavarri commented 2 years ago

Fixes https://github.com/ml-in-barcelona/jsoo-react/issues/121.

As usual, I am not 100% sure about all this 😅 but it seems to work, for both element creation functions, and prop creation functions.

OCaml syntax:

locs_ml

And Reason syntax:

locs_re

I have always wanted something like this in reason-react / rescript-react, so it's quite exciting to see it working. Thanks to the DSL api that @glennsl started, and the accurate types that @davesnx added in Html I think we can get really good dev experience.

Thanks as well to @trefis for all the work on explaining how Merlin and PPXs can work together. Without the pointers about "Refis laws" in https://github.com/ocaml/ocaml/pull/8987 and the js_of_ocaml PR in https://github.com/ocsigen/js_of_ocaml/pull/933, I would have not figured out what changes were required. I originally tried using -locations-check flag but no errors would come up (just the processed tree), I assume the original problem was not about "siblings overlap" but rather too many nodes sharing same locations.