Extension to format ocaml code and run it in interactive terminal.
This extension doesn't provide ocaml support in vscode, install one of available extensions for that.
It's wrapper for ocamlformat
.
Formats your ocaml code.
It formats your code predictably and following your favourite rules.
You can add your own formatting guidlines by either choosing one of preset profiles or making your own.
To make your own profile choose profile "own" and add formatting guidelines in .ocamlformat
file in project's root as defined in ocamlformat docs.
You can select fragment of code and run it in the ocaml interactive terminal in the vscode terminal by right clicking after selecting and choosing "Run code fragment in interactive console"
You must have installed:
- ocamlformat installed preferably globally otherwise set path to it in
ocamlformat-path
setting OCaml
- for running code in REPL
This extension contributes the following settings:
ocaml-formatter.profile
: choose formatting profileocaml-formatter.ocamlformat-path
: choose path to ocamlformat if it's not installed globally, path must be safe to use (eg no unsanitized spaces)ocaml-formatter.eval-opam-env
: evals opam env at every run if set to true, useful if use have ocamlformat installed locallyocaml-formatter.ocamlformat-path
: specifies how long should the extension wait between starting REPL and executing program
- Merlin sometimes marks code as invalid after formatting