Replace "empty locs" with locations that have loc_ghost set to true
Attach merlin.hide attribute to the make_props value binding, so that Merlin ignores everything inside this AST node
Attach merlin.hide attribute to the last make expression (the one that calls React.createElement), so that Merlin ignores everything inside this AST node.
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:
And Reason syntax:
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.
Fixes https://github.com/ml-in-barcelona/jsoo-react/issues/121.
loc_ghost
set totrue
merlin.hide
attribute to themake_props
value binding, so that Merlin ignores everything inside this AST nodemerlin.hide
attribute to the lastmake
expression (the one that callsReact.createElement
), so that Merlin ignores everything inside this AST node.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:
And Reason syntax:
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.