ocaml / merlin

Context sensitive completion for OCaml in Vim and Emacs
https://ocaml.github.io/merlin/
MIT License
1.57k stars 233 forks source link

`PKG ppx_bin_prot` prevents other packages from being loaded #790

Open mjambon opened 6 years ago

mjambon commented 6 years ago

Merlin behaves as if PKG ppx_bin_prot in a .merlin prevented other other PKG directives to be silently ignored. Here's a sample .merlin:

S .
PKG base64
PKG ppx_bin_prot

The package base64 provides a module B64. A sample ml (or mli) file is the following:

open B64

This results in Unbound module B64:

$ ocamlmerlin single errors -filename example.ml < example.ml
{"class":"return","value":[{"start":{"line":1,"col":5},"end":{"line":1,"col":8},"type":"error","sub":[],"valid":true,"message":"Unbound module B64"}],"notifications":[],"timing":{"total":0.9980000000000002,"query":0.3990000000000009,"reader":0.03200000000000003,"ppx":0.010000000000000675,"typer":0.5559999999999992,"error":0.0009999999999994458}}

Correct output can be obtained by commenting out PKG ppx_bin_prot in .merlin:

S .
PKG base64
#PKG ppx_bin_prot

correctly gives no errors:

{"class":"return","value":[],"notifications":[],"timing":{"total":1.021,"query":0.1999999999999993,"reader":0.039000000000000146,"ppx":0.01599999999999957,"typer":0.7640000000000002,"error":0.002000000000000668}}

Setup: ocaml 4.05.0, ppx_bin_prot v0.9.0, merlin 3.0.5.

It would be useful to get error messages if something fails to load. Is there a way to get more output from ocamlmerlin to help debug this?

trefis commented 6 years ago

We used to report such errors to the user, but apparently that isn't the case anymore... This is indeed a problem.