Get project‐wide occurrences - ocaml/merlin GitHub Wiki
When using OCaml 5.2 and since the release of merlin-lib 5.1-502, Emacs and Vim clients for merlin, as well as LSP clients for ocaml-lsp-sever can return project-wide results when searching for the occurrences of an identifier. This new feature require an index to be built beforehand.
Indexation
As of today, the simplest way to build (and keep up to date) an index of your project is to use a recent version of Dune (>= 3.16.0) and build the alias @ocaml-index in watch mode:
dune build @ocaml-index --watch
After that, it is possible to query for project-wide occurrences using:
merlin-project-occurrencesin emacsMerlinOccurrencesProjectWidein vimreferencesin LSP-based plugins.
Usage example in visual studio code
https://github.com/ocaml/merlin/assets/5031221/b6a9c276-d95e-474c-af6b-2f9b506966fa