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

OCaml Autocompletion

by whitequark ALL

Sublime Text plugin which provides OCaml autocompletion with ocp-index

Details

  • 2014.09.23.13.45.37
  • github.​com
  • github.​com
  • 10 years ago
  • 2 hours ago
  • 11 years ago

Installs

  • Total 4K
  • Win 1K
  • Mac 1K
  • Linux 1K
Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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.