ocaml/dune

double quote in .merlin is not right

Closed this issue · 8 comments

this line in .merlin:
FLG -ppx "_build/.ppx/4.04.0/ppx_type_conv+ppx_fields_conv/ppx.exe --as-ppx"

cause error when open .ml file.

"main.ml" 48L, 1028Csh: 1: Syntax error: Unterminated quoted string

(merlin) backtrace:
(merlin) project flags: unknown flag: --as-ppx"
Error detected while processing function merlin#Register..merlin#LoadProject:
line    2:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/hwu/.opam/4.04.0/share/merlin/vim/autoload/merlin.py", line 740, in setup_merlin
    failures = command("project","get")
  File "/home/hwu/.opam/4.04.0/share/merlin/vim/autoload/merlin.py", line 201, in command
    return merlin_process().command(context(cmd))
  File "/home/hwu/.opam/4.04.0/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/.ppx/4.04.0/ppx_type_conv+ppx_fields_conv/ppx.exe \
'/tmp/camlppx8a78b1\' \'/tmp/camlppx16180d\' 1>/dev/null 2>/dev/null', u'valid': True, u'type': u'type', u'sub': []}

change double quote to single quote, the problem disappear.

FLG -ppx '_build/.ppx/4.04.0/ppx_type_conv+ppx_fields_conv/ppx.exe --as-ppx'

@let-def Should .merlin accept double quotes here?

This should work with dev version, not the released one yet.
Try with:
opam pin add merlin --dev-repo

@let-def, moving forward, is the recommendation to use single or double quotes?

Any, I am trying to follow shell conventions, so single quote for exact string, double quote might allow some expansion in the future (right now it is also just quoting).

(The change in git version is that quoting is handled, previously merlin wasn't really trying to interpret the string.)

Does it make to just stick to single quotes for now then? At least until jbuilder needs to generate .merlin files with interpolation in the quotes.

I don't think the released merlin behave properly even with single quotes, and the git version works with both. So either should be fine :).

I don't think the released merlin behave properly even with single quotes

Confirmed.
(I'm guilty)

I think this is still an issue - not sure if it's a jbuilder or merlin issue though. I see the same issue as the linked mirage/charrua#62 issue discusses but in a local project. If I manually remove the --cookie '"library=foo"' portion of the FLG line in .merlin then merlin works fine during editing.