ocaml/merlin

No config found for file .ocamlinit. Try calling 'dune build'.

dalps opened this issue · 3 comments

Hi, the dune guys suggested I report this issue (feature request?) to merlin or OCamlLSP issue tracker, but I believe here is more appropriate.

I have a small gripe with merlin, being that it is unable to properly type check or provide code completion for external modules loaded in an .ocamlinit file. Any module I open there results in an Unbound module error.

The root of the problem seems to be this error that lurks in the first line of an .ocamlinit within a dune project (image is taken in VS Code, but I see it in vim too):

image

I understand that it happens because an .ocamlinit file is just read and interpreted by the toplevel, it is not compiled by the build system; still it would be nice if merlin could make an effort to fully type check this kind of file, I myself use it quite often for debugging purposes and I think such feature would greatly improve the UX of the toplevel in dune projects.

Transferring here since I think the fix should be done in the lsp server: if the file kind is .ocamlinit we should not try to load a configuration for it.

However the error does not prevent Merlin from "working" in the buffer:
image

Hi @voodoos, are you sure this is not merlin's responsibility? As I said, I see this error in vim too, which (correct me if I'm wrong) doesn't use the LSP server. My .vimrc is configured by opam user-setup and there's no mention of the lsp.

Ah, I think you're right, sorry for the back and forth :-)