ocaml-lsp
ocaml-lsp copied to clipboard
I/O error with files in a subdirectory
Hi, first: thanks for your efforts in improving the OCaml developer experience.
I'm using Codium (a variant of VS Code without MS' telemetry). The structure of my (private) project features an src/
dir as well as an src/test/
subdir (with ppx_expect tests only). There is a dune
file in src/
with, in particular, the (include_subdirs unqualified)
instruction. In the auto-generated src/.merlin
, I have S .
and S test
.
However, Codium shows an error message in the "Problems" pane, issued by ocaml-lsp, for every file lying in src/test
:
I/O error: test_foo.ml: No such file or directory
ocamllsp [2, 1]
However, dune
builds and runs tests without any issue.
Also, if test_foo.ml
is moved to src
, Codium/ocaml-lsp shows no more error.
So it's fortunately not a show-stopper but I guess it may indicate a problem to be solved.
I can replicate this with a somewhat minimal example. Not related to include_subdirs
it triggers seemingly depending on levels of dir path, ie path is stripped somewhere. This is only for ppx_expect tests, ppx_inline_test works fine.
I/O error: example_a.ml: No such file or
directory
This is only shows in vscode/lsp. dune works fine.
For below project
- ppx_expect test is ok in
./lspbug/lib/
- ppx_expect test is fails in viscose with "" in
./lspbug/lib/a/
- ppx_inline tests work in all cases.
├── dune-project
└── lspbug
└── lib
├── a
│ ├── dune
│ └── example_a.ml
├── dune
└── example.ml
I'm not able to run ocamllsp with logging output.
lspbug/lib/dune
(library
(inline_tests)
(name lspbug_root)
(preprocess
(pps ppx_inline_test ppx_expect)))
lspbug/lib/a/dune:
(library
(inline_tests)
(name lspbug_a)
(preprocess
(pps ppx_inline_test ppx_expect)))
example.ml/example_a.ml
let%expect_test _ = print_endline "foo"
This seems to an unresolved issue with merlin: https://github.com/ocaml/merlin/issues/1095
Maybe I messed up in previous example, please ignore: The following does not work using ppx_expect
├── a
│ ├── dune
│ └── example_a.ml
└── dune-project
This does
├── dune
├── example_a.ml
└── dune-project
Alternatively.
Simply open this project (ocaml-lsp) with vscode and ocaml-platform extension and open a file that uses with ppx_expect. Ie. fiber-unix/test/barrier_test.ml
I'm seeing this too and it appears to be a relatively new regression since it only started happening recently, my underlying project code hasn't changed.
Any news/workaround for this issue?
Can this bug still be reproduced in master?
This seems to be fixed in master.