ocamllabs / vscode-ocaml-platform

Visual Studio Code extension for OCaml
ISC License
342 stars 72 forks source link

Mismatches between ml and mli are not presented clearly #827

Open yminsky opened 2 years ago

yminsky commented 2 years ago

I've noticed that the plugin does not do a good job of reporting mismatches between the ml and mli. In the project in question, running dune produces an actionable error message:

Entering directory '/home/yminsky/Code/game-programming-bxsci-2021/multi-uttt'
File "lib/miniboard.ml", line 1:
Error: The implementation lib/miniboard.pp.ml
       does not match the interface lib/.multi_uttt.objs/byte/multi_uttt__Miniboard.cmi:
        The value `get_space' is required but not provided
       File "lib/miniboard.mli", line 13, characters 0-50:
         Expected declaration
       The value `set_space' is required but not provided
       File "lib/miniboard.mli", line 16, characters 0-51:
         Expected declaration

But in vscode, the error shows up by underlining the open declaration at the top of the file, and the text of the error is:

The implementation lib/miniboard.pp.ml

which is not especially helpful.

ulugbekna commented 2 years ago

Hi, thanks for the report!

I'd like to reproduce the problem, but I don't get any errors when the ml and corresponding mli file mismatch (merlin doesn't detect such mismatches in general, to my understanding). Do you have your project available online somewhere?

re: unclear error message The error message is indeed unclear. I'll see if we can improve that.

re: actionable error There's an ongoing work for dune RPC integration in ocaml-lsp & this extension, so we should in future be able to suggest the user some actions to fix these errors.

yminsky commented 2 years ago

Oddly, I've had trouble reproducing it on a small example. I'm not sure why.