Skip to content
No description, website, or topics provided.
OCaml Shell Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Language Server Index Format for OCaml

Export OCaml type hovers and jump-to-definitions in LSIF

Note: development is early work-in-progress; the tool is released in the interest of early adopters who may find it immediately useful for open source projects.

What is LSIF?

The Language Server Index Format (LSIF) is a format for storing code intelligence data like type hovers and jump-to-definitions. See LSIF and how it relates to LSP for more details. Platforms like Sourcegraph use LSIF to surface this information in your browser.

Quickstart : generate LSIF dump

  1. Pin and install opam pin add merlin-lsif\#lsif. This installs an extension of merlin that dumps type and definition data. Installing merlin-lsif will not conflict with existing merlin installations.

  2. Pin and install opam pin add lsif-ocaml

  3. Compile your OCaml project. Note: lsif-ocaml depends on .merlin files to work

  4. At the root of your directory, run lsif-ocaml-dump

  5. Run lsif-ocaml -only-type-hovers > data.lsif

  6. Optionally delete the * files in your repository with find . -name * | xargs rm, or keep them around and update your data.lsif for changed files in new commits.


Generating LSIF takes a while, how can I make it faster?

Initially generating an LSIF file can take some time (20 minutes on a Macbook for large projects). You can speed it up with lsif-ocaml-dump -p to generate * files in a (less stable) parallel frenzy. Note that once every .ml* file is processed, * files only need to be updated for changed files. Easily regenerate a smaller number of files by running lsif-ocaml-dump in subdirectories, or with, e.g.,:

cat | ocamlmerlin-with-lsif server lsif -dot-merlin ./path/where/update-file/lives/.merlin >
You can’t perform that action at this time.