How to best deal with ocsigen/eliom incompatibilities with merlin?

As far as I understand, merlin can only be configured to work either for client or for server-side Eliom.
What do I need to do in order to configure it for client?
Also, what would be “best practices” in this regard? I presume, splitting files in such a way that only very few (and small) ones have both client and server code?

So for what setup did you finally settle? Where you able to make it somehow work for most of the code? I also saw that you commented here: https://github.com/ocsigen/eliom/issues/532, but that file does not work out of the box. I am getting an Unbound value __eliom__compilation_unit_id__KwWvUI

I learned TypeScript, React and GraphQL :frowning:
Now I only use OCaml for data transforming libraries on the frontend and definitely nothing that has something to do with the DOM.

It is not possible to have Merlin understand the structure of an eliom file made of both client and server parts. Nevertheless, it is still possible to have Merlin only consider the server parts (and so the shared parts) of your files. Here is an example of configuration that is more or less satisfying:

PKG lwt_ppx
PKG eliom.server
PKG eliom.ppx.server
PKG ppx_deriving.show
PKG ppx_deriving.ord
PKG ppx_deriving.sexp
PKG ocsigen-toolkit.server
PKG ocsigen-start.server
PKG pgocaml_ppx

SUFFIX .eliom .eliomi

S .

B _server

Note again that this configuration will entirely skip the client part of your eliom files. Moreover, it is not possible to switch to the client version of this configuration. Once the server parts have been compiled, eliomc hands over to js_of_eliom the type annotations of variables defined on the server side and used on the client side. Currently, Merlin cannot be made aware of the existence of those type annotations

2 Likes