ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

OCaml Autocompletion

by whitequark ST2/ST3

Sublime Text plugin which provides OCaml autocompletion with ocp-index

Details

  • 2014.09.23.13.45.37
  • github.​com
  • github.​com
  • 3 years ago
  • 2 hours ago
  • 4 years ago

Installs

  • Total 2K
  • Win 597
  • OS X 955
  • Linux 841
Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5
Windows 0 0 0 2 0 0 1 2 1 1 0 0 2 0 0 0 0 0 3 0 0 0 0 1 0 0 0 0 1 0 1 0 0 1 0 2 1 1 1 0 2 0 0 0 0 1
OS X 0 0 0 0 0 1 2 0 0 0 1 1 2 0 0 0 0 2 1 0 0 0 0 1 0 1 1 0 2 2 1 2 1 2 1 1 0 2 0 1 0 0 1 1 2 1
Linux 0 0 2 2 0 0 2 0 1 0 1 0 0 1 3 0 1 2 0 1 0 1 0 0 1 3 1 0 0 1 0 0 1 3 1 3 3 1 1 1 0 1 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

OCaml autocompletion for Sublime Text

Installation

opam install ocp-index

Usage

Within OCaml syntax files:

  • Standard sublime autocompletion is completely replaced with OCaml autocompletion
  • Type inspection of variables is available via the alt+a shortcut, which displays the type in the status bar

Build configuration

You need to pass the -bin-annot flag to ocamlc/ocamlopt. You are probably using a build system, so follow the guide below.

If you are not using one of the standard build output folders then a setting is available to pass the --build parameter to ocp-index:

"sublime_ocp_index_build_dir": "gen/ml"

This setting can be applied as a user preference or (recommended) in your .sublime-project file.

ocamlbuild

Ocamlbuild 4.01 supports generating binary annotations out of the box, with the bin_annot tag. In your _tags:

true: bin_annot

For earlier versions of Ocamlbuild, this can be replicated by adding one line to myocamlbuild.ml:

flag ["ocaml"; "compile"; "bin_annot"] (A"-bin-annot");

License

The MIT License

A note about ocp-index versions

This plugin uses ocp-index -I <folder> to enable searching local project libraries. Prior to the 1.0.2 release, this disabled searching OPAM libraries. To show OPAM libraries in autocomplete results with this version, use the following setting:

"sublime_ocp_index_include_local_packages": false

This can be applied globally in your user settings or overridden in a .sublime-project file.