Npm Osx



Visual Studio Code extension for OCaml and relevant tools.

Please report any bugs you encounter.

Quick start

Npm OsxNpm

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. Type npm config list to view a list of all npm configurations that are active. Type npm config edit to open a text editor with npm configurations. To remove the proxy line ( or simply comment it out ). Save the config file and close it. Type npm config list to confirm that the proxy configuration has been removed.

  1. 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)
  2. Open a OCaml/ReasonML project (File > Add Folder to Workspace...)
  3. 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:

Npm Osx

  1. Install esy
  1. Add esy.json to the project root with following content:
  1. 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.

NameDescriptionDefault
ocaml.sandboxDetermines where to find the sandbox for a given projectnull
ocaml.dune.autoDetectControls whether dune tasks should be automatically detected.true
ocaml.trace.serverControls the logging output of the language server. Valid settings are off, messages, or verbose.off
ocaml.useOcamlEnvControls whether to use ocaml-env for opam commands from OCaml for Windows.true
ocaml.terminal.shell.linuxThe path of the shell that the sandbox terminal uses on Linuxnull
ocaml.terminal.shell.osxThe path of the shell that the sandbox terminal uses on macOSnull
ocaml.terminal.shell.windowsThe path of the shell that the sandbox terminal uses on Windowsnull
ocaml.terminal.shellArgs.linuxThe command line arguments that the sandbox terminal uses on Linuxnull
ocaml.terminal.shellArgs.osxThe command line arguments that the sandbox terminal uses on macOSnull
ocaml.terminal.shellArgs.windowsThe command line arguments that the sandbox terminal uses on Windownull
ocaml.repl.pathThe path of the REPL that the extension usesnull
ocaml.repl.argsThe REPL arguments that the extension usesnull

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 has utop installed, the REPLwill be dune utop
  • If dune build fails and the current sandbox has utop installed, the REPLwill be utop
  • Else, the REPL will be ocaml

If a REPL already exists, it will be used instead, so if you installed utopafter openning a REPL, or if you fixed your project compilation, you will needto re-open the REPL to change it.

Commands

Npm Osx

You can execute it by entering the following command at the command paletteCtrl+P (Cmd+Shift+P onMacOS).

NameDescriptionKeyboard ShortcutsMenu Contents
ocaml.select-sandboxSelect sandbox for this workspace
ocaml.server.restartRestart language server
ocaml.open-terminalOpen a terminal (current sandbox)
ocaml.open-terminal-selectOpen a terminal (select a sandbox)
ocaml.current-dune-fileOpen Dune File (located in the same folder)
ocaml.switch-impl-intfSwitch implementation/interfaceAlt+O
ocaml.open-replOpen REPL
ocaml.evaluate-selectionEvaluate SelectionShift+Enter

Npm Osx Remove

Requirements