How to get merlin to do a good job on project dependencies? How to get dune to generate better .merlin files?

It’s a very convenient feature for dune to generate .merlin files. However merlin does not seem to do a good job with recognizing symbols and locations in project dependencies (though it does a good job for the main project itself)

The B and S in the .merlin file mostly point to the _opam/lib folder for project dependencies. A lot of symbols have problems in being recognized there.

One possible idea is to do opam install -b ... to preserve the build files and then the build is available in _opam/.opam-switch/build/and there merlin seems to do a stellar job. Unfortunately the way .merlin is setup, symbols refer to the _opam/lib folder and not the build folder.

My question is how to I get merlin to reliably work with with source code of project dependencies? Ideally they should point to the build folder.

merlin should work out of the box because dune knows how to build the project but sadly it does not. Perhaps I’m doing some thing wrong?


One approach is to leave the B entries as they are, remove all the S entries with a single entry S /<full-path-to-project>/_opam/.opam-switch/build/** (here I’m assuming the project is within a switch of its own…)

I could also remove all the B entries with B /<full-path-to-project>/_opam/.opam-switch/build/** but have to experiment with that.

Yes, adding:

B /<full-path-to-project>/_opam/.opam-switch/build/**
S /<full-path-to-project>/_opam/.opam-switch/build/** 

is sufficient with opam install -b ... but this has to be done manually :frowning: