I’d like to avoid, for now, using dune to build my ocaml project.
I’m using ocamlbuild, a _tags file to specify dependencies such as the Unix module. Can the ocaml-lsp-server be configured to pick up on that and not report Unix as an unbound module?
I don’t know how much of OCaml LSP is related to merlin nowadays.
But if they still are. You can perhaps have that by writing a .merlin file. Here’s an example (note for an ocamlbuild build you rather want B _build/** than what you find in this example).
There is a --fallback-read-dot-merlin option for ocamllsp to do that.
$ ocamllsp --help
ocamllsp [ --stdio | --socket PORT | --port PORT | --pipe PIPE ] [ --clientProcessId pid ]
--version print version
--fallback-read-dot-merlin read Merlin config from .merlin files. The `dot-merlin-reader` package must be installed
--pipe set pipe path
--socket set the port
--port synonym for --socket
--stdio set stdio
--node-ipc not supported
--clientProcessId set the pid of the lsp client
-help Display this list of options
--help Display this list of options
After installing dot-merlin-reader, passing the --fallback-read-dot-merlin flag to the lsp and dropping the following .merlin file in my project root I have everything running without any Unbound module errors.
Thanks for the heads-up. I already had a few modules compiled in _build and it worked without the Source directive but would have failed on a clean checkout.