Merlin: Goto definition inside installed libraries

BTW I notice that @brocaml already had suggested the opam monorepo approach in his comment above a few months ago – props for that. Though his example is about a fresh project. I want to indicate that you can do this for any exisiting project also.

So lets say you want to get the full ocaml-lsp experience while looking at the dream source code and its libraries. (I chose dream just as a random example that works).

$ mkdir dream-switch
$ cd dream-switch
$ opam switch create . 4.12.0

# Adds the ability to dune build ocaml projects that are dream dependencies
# but dont use `dune` in their default repos
$ opam repository add dune-universe git+https://github.com/dune-universe/opam-overlays.git
$ opam update

$ git clone https://github.com/aantron/dream.git 
$ cd dream
$ opam monorepo lock
$ opam monorepo pull
$ dune build -p dream

# Now you can install ocaml-lsp 
$ opam install ocaml-lsp-server
1 Like