I have been trying for a long while now to work with ReasonML files in VSCode and get some syntax highlighting. This has been a problem since ReasonML on the frontend has moved on to Rescript. The solution would be using Melange but I could not get the editor highlighting to work. I have a bunch of old ReasonML projects that I still refer to so losing the editor support has been less than ideal. The code still works but you are stuck relying on the terminal output for errors.
I finally got it to work with the help of @zecklar on the ReasonML Discord forum.
Here is the solution that works.
- Install OCaml plugin https://marketplace.visualstudio.com/items?itemName=ocamllabs.ocaml-platform
- Build your project esy build
- Launch VSCode in your esy dev environment
esy code .
- On the lefthand side, click OCaml extension icon
- Click "Select sandbox"
- Select "Custom" from the dropdown
- Pass the flag, the input box should contain $prog $args --fallback-read-dot-merlin
- Voila, at least typehints/navigation etc seem to work
You can try it with this repo.
This isnt working for rescript yet but I will update you if I figure it out.
Many thank, @zecklar.