Open MdeLv opened 1 year ago
I am not familiar with Ocsigen build system, but I would. It looks like support is not great. The following configuration is proposed on a an open eliom issue:
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
Hi, Thanks for your quick feedback.
Presently, I can handle the client side with some templates. The server side is my priority to be able to navigate:
SERVER_FILES := $(wildcard *.eliomi *.eliom *.ml) \
I tried your sound .merlin file.
I make cleaned+recompiled.
It looks that I get only the usual autocompletion from editor buffer (e.g. Test_container.eliom
).
But not yet those never used before (e.g. Test_handler.eliom
)
I'm using vscode
+extension ocaml-platform
+ opam package ocaml-lsp-server
.
I created a new program with package calendar
: Merlin (and autocompletion) works correctly : I can go to definition.
Is there a way to see exactly what is happening when using Merlin and autocompletion? (Merlin log file, lsp-server log file or any other tool)
This is a great chance to much more understand these Ocaml toolings. Thanks.
In fact, your issue might be due to ocaml-lsp-server
ignoring the .merlin
config all together.
There is a --fallback-read-dot-merlin
flag that should be passed to the server, but I am not sure of the best way to do it. @anmonteiro, it looks like you used that flag for melange, do you happen to now the best way to set it in vscode ?
I use a few special Ocaml packages that do not follow the usual Ocaml way.
For instance, Ocsigen makes a specific compilation for _server and _client sides. There are .cmi, .cmo, .cmx, .cmt and .type.mli for the _server side. There are .cmi, .cmo, .js for the _client side.
From the specification of a .merlin file, I tried to point to the correctly compiled interfaces (with vs code + extension ocaml-platform + opam package ocaml-lsp-server) to get Merlin support.
I started with something like:
But as I don't exactly know the unusual structure of the pointed files, and how exactly Merlin handles the usual stuff, I'm blind. It doesn't work.
Can you give a hint about the right way to inform Merlin of the available and correct (although unusual) compiled interfaces (I understand Merlin requires)? Thanks.