How to get merlin working with camlp4 preprocessing?

Hi, I’m having some issues using merlin, and wondered if anyone had any tips?

Merlin works great for files that don’t use camlp4, but gives syntax errors for all syntax that is supposed to be processed by camlp4.
Specifically, I have code like this in emacs:

let parse_identifier = parser
                     | [< '(Token.Identifier ident,_) >] -> ident
                     | [< err=error_expected "an identifier" >] -> raise err

Compiling works great with the following in the _tags file:

<{lexer,parser,token}.ml>: use_camlp4, pp(camlp4of)

But as far as I know, merlin doesn’t use this file, instead reading the .merlin file, which contains the following:

REC

Which references the .merlin file in the parent directory:

FLG -pp camlp4of
PKG llvm camlp4
S src
B _build/src

Merlin works great in files that don’t need camlp4, and handles references between files and everything. In the files using the parser syntax however, I always get ‘Unbound value parser’, and no further errors.
NB: I have tried using EXT in .merlin, but it didn’t seem to make a difference.

Any help would be much appreciated, thanks in advance.

Merlin has/had specific support for some camlp4 extensions, but it doesn’t support arbitrary camlp4 syntaxes (see this comment, for example)

camlp4 is deprecated - if you need Merlin, you need to switch to ppx