ocaml-lsp
ocaml-lsp copied to clipboard
Diagnostics incorrect for build directories other than `_build`
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.
Minimal example for reproduction
dune init project lsptest && cd lsptest
touch lib/some_file.ml
dune build -w --build-dir=_build_lsp
Then open lib/some_file.ml from an editor supporting LSP.