ocp-index is designed as a simple and light-weight documentation extractor for
OCaml, for command-line use or integrated in other tools (e.g. for
completion). It gathers information from .cmi (à la ocamlbrowser) and
.cmt/cmti files, including structure, location, type, and ocamldoc comments
when available.
ocp-index COMMAND params OPTIONS
Examples:
ocp-index type Module.identocp-index complete idenocp-index doc Module.ident(TODO)ocp-index locate Module.ident
Options:
-
-Iinclude dirs / loaded libraries -
-Oconsider given module as open -
output format:
--color,--show/--hideto control the kinds of idents to display
./configure
make
make install
See below to compile and install the optional ocp-browser.
ocp-index will look for a .ocp-index file in the current project or in your
home directory. The file format is not final at the moment and likely to
change. That said, if you want to try it out, you can put a file .ocp-index at
the root of your project containing rec dir _build (or whatever the name of
your build dir) to have ocp-index lookup the interfaces from your current
project.
A script ocp-index.el is included under tools/, and can be used together
with tuareg-mode or ocaml-mode and
auto-complete (packaged as
auto-complete-el in Debian) to get completions and types in a popup menu.
You can run the script tools/emacs-setup.sh to get hints on the configuration
of emacs for ocp-index (it won't modify any files). Adding the following
line to your .emacs:
(load-file "<OPAM_ROOT>/share/typerex/ocp-index/ocp-index.el")Will give you:
C-c TABto auto-complete ((global-set-key (kbd "KEY") 'auto-complete) to add your own binding)C-c tto print the type of the identifier under cursorC-c ;to jump to the definition of the identifier under cursor
See M-x customize ocp-index for more options.
A small ncurses-based browser based on ocp-index is also included. You will need ocaml-curses installed to build it:
$ opam install curses
$ ocp-build ocp-browser
$ ocp-build install ocp-browser