ocaml / merlin

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

External preprocessor failure #1246

Open Kakadu opened 3 years ago

Kakadu commented 3 years ago

(Cross post from https://discuss.ocaml.org/t/using-merlin-with-camlp5/7082)

I created demo project where I use external preprocess for a library and PPX-based one. Both seems to create files with contents type "OCaml abstract syntax tree implementation file (Version 027)" but for custom preprocessor merlin can't read the generated file. It looks like that it tries to parse it as plain text file.

Using automatically compiled PPX rewriter doesn't raise that error.

image

Any idea where the issue can be?

voodoos commented 3 years ago

Not investigated yet, but this seems related to https://github.com/ocaml/dune/issues/4169

progman1 commented 3 years ago

-pp not accepting an AST is an open issue: ocaml/merlin#966

I went with merlin-extend in the end as is used by the reason project. [amended] if merlin allowed an external parser (to AST) that might disable its ability to do incremental parsing. On the other hand ppxlib incorporates the ocaml parser and so is a compiler frontend and I don't know how merlin exactly handles that. Perhaps the generated ppx.exe is used only in '-as-ppx' mode by merlin whereby parsing control might be retained.