Visual Studio Code extension for OCaml and relevant tools.
Npm install esy -global. Ocaml.terminal.shell.osx: The path of the shell that the sandbox terminal uses on macOS: null: ocaml.terminal.shell.windows. To confirm that npm uninstall worked correctly, check that the nodemodules directory no longer contains a directory for the uninstalled package(s). Unix system (such as OSX): ls nodemodules Windows systems: dir nodemodules. Npm install pdf-image Ensure you have convert, gs, and pdfinfo (part of poppler) commands. Ubuntu sudo apt-get install imagemagick ghostscript poppler-utils OSX (Yosemite) brew install imagemagick ghostscript poppler Usage Convert single page.
Please report any bugs you encounter.
Quick start
- Install this extension fromthe VSCode Marketplace(or by entering
ext install ocamllabs.ocaml-platform
at the command paletteCtrl+Shift+P(Cmd+Shift+P on MacOS) - Open a OCaml/ReasonML project (
File > Add Folder to Workspace...
) - Install OCaml-LSP withopam or esy.E.g.
opam install ocaml-lsp-server
Windows
Install OCaml for Windows andmake sure the ocaml-env
program is accessible on the PATH (ocaml-env
is inthe usr/local/bin
folder relative to the installation directory).
ReScript / BuckleScript
The new ReScript syntax (res
and resi
files) is not supported, you shoulduse rescript-vscode instead.
ReasonML, as an alternative syntax for OCaml, is supported out-of-the-box, aslong as reason
is installed in your environment.
If you're looking for a way to use OCaml or ReasonML syntax in a ReScriptproject, you'll need to install ocaml-lsp
in your environment. We recommendusing Esy for this:
- Install esy
- Add
esy.json
to the project root with following content:
- Install and build packages
Features
- Syntax highlighting
- ATD
- Cram tests
- Dune
- Menhir
- Merlin
- META
- OASIS
- OCaml
- OCamlbuild
- OCamlFormat
- OCamllex
- opam
- ReasonML
- Eliom
- Indentation rules
- Snippets
- Dune
- OCaml
- OCamllex
- Task Provider
- Dune
Configuration
This extension provides options in VSCode's configuration settings. You can findthe settings under File > Preferences > Settings
.
Name | Description | Default |
---|---|---|
ocaml.sandbox | Determines where to find the sandbox for a given project | null |
ocaml.dune.autoDetect | Controls whether dune tasks should be automatically detected. | true |
ocaml.trace.server | Controls the logging output of the language server. Valid settings are off , messages , or verbose . | off |
ocaml.useOcamlEnv | Controls whether to use ocaml-env for opam commands from OCaml for Windows. | true |
ocaml.terminal.shell.linux | The path of the shell that the sandbox terminal uses on Linux | null |
ocaml.terminal.shell.osx | The path of the shell that the sandbox terminal uses on macOS | null |
ocaml.terminal.shell.windows | The path of the shell that the sandbox terminal uses on Windows | null |
ocaml.terminal.shellArgs.linux | The command line arguments that the sandbox terminal uses on Linux | null |
ocaml.terminal.shellArgs.osx | The command line arguments that the sandbox terminal uses on macOS | null |
ocaml.terminal.shellArgs.windows | The command line arguments that the sandbox terminal uses on Window | null |
ocaml.repl.path | The path of the REPL that the extension uses | null |
ocaml.repl.args | The REPL arguments that the extension uses | null |
If ocaml.terminal.shell.*
or ocaml.terminal.shellArgs.*
is null
, theconfigured VSCode shell and shell arguments will be used instead.
If ocaml.repl.path
or ocaml.repl.args
is null
, the default REPL is usedinstead. The default REPL used depends on the packages installed in your currentsandbox:
- If
dune build
passes and the current sandbox hasutop
installed, the REPLwill bedune utop
- If
dune build
fails and the current sandbox hasutop
installed, the REPLwill beutop
- Else, the REPL will be
ocaml
If a REPL already exists, it will be used instead, so if you installed utop
after openning a REPL, or if you fixed your project compilation, you will needto re-open the REPL to change it.
Commands
You can execute it by entering the following command at the command paletteCtrl+P (Cmd+Shift+P onMacOS).
Name | Description | Keyboard Shortcuts | Menu Contents |
---|---|---|---|
ocaml.select-sandbox | Select sandbox for this workspace | ||
ocaml.server.restart | Restart language server | ||
ocaml.open-terminal | Open a terminal (current sandbox) | ||
ocaml.open-terminal-select | Open a terminal (select a sandbox) | ||
ocaml.current-dune-file | Open Dune File (located in the same folder) | ||
ocaml.switch-impl-intf | Switch implementation/interface | Alt+O | |
ocaml.open-repl | Open REPL | ||
ocaml.evaluate-selection | Evaluate Selection | Shift+Enter |