You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running a continuous dune build in the _build_lsp directory (via dune build -w --build-dir=_build_lsp) in order to be able to run other dune commands in the default _build directory.
From the logs I can see that ocamllsp recognises the active dune instance in this directory (for RPC)
Connected to dune /path/to/project (/path/to/project/_build_lsp/.rpc/dune)
client 0: connecting...
client 0: connected to dune at unix:///path/to/project/_build_lsp/.rpc/dune
however if there is no _build folder, the diagnostics give me an error along the following
No config found for file lib/some_file.ml. Try calling 'dune build'.
Indeed running dune build (and creating the up to date _build directory) will silence the notification.
I think the mismatch here is due to the fact that OCaml-LSP does not use the RPC to gets Merlin configuration, but starts a specialized configuration server: dune ocaml-merlin. In your case that server should also be started with the correct argument. Unfortunately this is not configurable right now.
The RPC would be the ideal way to get configuration from Dune, but until that happens there might be a simple workaround: the build dir can be set via an environment variable: DUNE_BUILD_DIR. Can you try starting your editor / ocaml-lsp in an environment where this variable has the correct value ? (DUNE_BUILD_DIR=_build_lsp)
Yes this works like a charm! Thanks for the quick solution.
Also, for anyone reading this in the future and using Neovim as their editor, setting the environment variable can be achieved (at least with lspconfig) by adding the cmd_env key to the ocamllsp config:
I'm running a continuous dune build in the
_build_lsp
directory (viadune build -w --build-dir=_build_lsp
) in order to be able to run other dune commands in the default_build
directory.From the logs I can see that ocamllsp recognises the active dune instance in this directory (for RPC)
however if there is no
_build
folder, the diagnostics give me an error along the followingIndeed running
dune build
(and creating the up to date_build
directory) will silence the notification.Minimal example for reproduction
Then open
lib/some_file.ml
from an editor supporting LSP.The text was updated successfully, but these errors were encountered: