User Manual
4. Integration into IDEs
- Local configuration (.ocamlwizard files)
Instead of passing options to Ocamlwizard on its command line, they can be provided in local .ocamlwizard files.
For instance, if source files are locates in two subdirectories foo/ and bar/ then foo/ may contain a .ocamlwizard file as follows:
- Makefile
For bytecode compilation, update the rules as follows:
ocamlc -c $(FLAGS) $<
ocamlc -c $(FLAGS) $<
For native code compilation, add the following line:
ocamlopt -c $(FLAGS) $<
- Emacs
A minimal Emacs Lisp integration is provided. It is contained in file emacs/ocamlwizard.el in Ocamlwizard sources. Once loaded, it adds the following key bindings to Emacs:
- f1: jumps to an identifier declaration/definition using ocamlwizard locate; when there are several locations (one declaration and one definition typically), you can jump to the second one using Emacs next-error
- f3: completes a match with expression, when cursor is located right after the with keyword
- f11: expands a pattern-matching variable
- f12: proposes possible expansions for a (possibly incomplete) path expression
Note: This is a quick and dirty implementation, which uses global-set-key to set the key bindings. A better implementation should provide these bindinds in the Tuareg-mode only, or some Emacs minor mode.
- Eclipse
A proof-of-concept integration in Eclipse has been implemented. It is an Eclipse plugin providing a new editor, called OcamlwizardToolEditor. Within this editor, Ctrl-space triggers completion and F5 jumps to declaration/definition point (and F6 to the next point, if any).
To install the plugin, use menu Help -> Software Updates -> Find and Install in Eclipse and then use the New Local Site button, pointing to the subdirectory eclipse/ in Ocamlwizard sources.