ocaml-lsp icon indicating copy to clipboard operation
ocaml-lsp copied to clipboard

Diagnostics incorrect for build directories other than `_build`

Open MoritzHamann opened this issue 10 months ago • 2 comments

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.

MoritzHamann avatar Dec 29 '24 12:12 MoritzHamann