mirage/ocaml-cstruct

New ppx breaks merlin?

Closed this issue · 3 comments

From a clone of the latest master branch. This is using OCaml 4.04.0+flambda, merlin 2.5.4 and jbuilder 1.0+beta9.

I suspect ppx because of this:

(merlin) project flags: unknown flag: --as-ppx"

More complete error dump:

$ vim ppx_test/basic.ml
sh: -c: line 0: unexpected EOF while looking for matching `"'
sh: -c: line 1: syntax error: unexpected end of file
(merlin) backtrace:
(merlin) project flags: unknown flag: --as-ppx"
Error detected while processing function merlin#Register[117]..merlin#LoadProject:
line    2:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/hcarty/.opam/4.04.0+flambda/share/merlin/vim/autoload/merlin.py", line 740, in setup_merlin
    failures = command("project","get")
  File "/Users/hcarty/.opam/4.04.0+flambda/share/merlin/vim/autoload/merlin.py", line 201, in command
    return merlin_process().command(context(cmd))
  File "/Users/hcarty/.opam/4.04.0+flambda/share/merlin/vim/autoload/merlin.py", line 168, in command
    raise Error(value)
merlin.Error: {u'message': u'Error while running external preprocessor\nCommand line: "../_build/default/.ppx/ppx_cstruct/ppx.exe \'/var/folders/7w/pj7qnfc91jg9bn79pbsb14g80000gp/T/camlppxc6e34b\' \'/var/folders/7w/pj7qnfc91jg9bn79pbsb14g80000gp/T/camlppx60800a\' 1>/dev/null 2>/dev/null', u'valid': True, u'type': u'type', u'sub': []}sh: -c: line 0: unexpected EOF while looking for matching `"'
sh: -c: line 1: syntax error: unexpected end of file

with several more repetitions of the same or similar errors.

@diml @let-def This may be a jbuilder or merlin issue. I can make it work by editing the generated ppx_test/.merlin and swaping double quotes " with single quotes ':

FLG -ppx "../_build/default/.ppx/ppx_cstruct/ppx.exe --as-ppx"

with

FLG -ppx '../_build/default/.ppx/ppx_cstruct/ppx.exe --as-ppx'

Then merlin works as expected.

Apologies - this seems to be a known issue (ocaml/dune#30) - with the fix being to pin to merlin's dev repo.