Skip to content

Visual Studio Code extension for OCaml

License

Notifications You must be signed in to change notification settings

mnxn/vscode-ocaml-platform

 
 

Repository files navigation

VSCode OCaml Platform

Main workflow

Visual Studio Code extension for OCaml and relevant tools.

This plugin is alpha quality. Use at your own risk and please report any bugs you encounter.

Quick start

  1. Install this extension from the VSCode Marketplace (or by entering ext install ocamllabs.ocaml-platform at the command palette Ctrl+P)
  2. Open a OCaml/ReasonML project (File > Add Folder to Workspace...)
  3. Install OCaml-LSP with opam or esy.

BuckleScript

There is currently no way of installing OCaml-LSP natively for BuckleScript projects. As a fast workaround, you can use esy:

  1. Install esy
npm install esy --global
  1. Add esy.json to the project root with following content:
{
  "dependencies": {
    "@opam/ocaml-lsp-server": "ocaml/ocaml-lsp:ocaml-lsp-server.opam",
    "@opam/reason": "*",
    "ocaml": "4.6.x"
  },
  "resolutions": {
    "@opam/dune-configurator": "2.0.1",
    "@opam/dune-private-libs": "2.0.1",
    "@opam/dune": "2.0.1",
    "@opam/menhir": "20200123",
    "@opam/menhirLib": "20200123",
    "@opam/menhirSdk": "20200123"
  }
}
  1. Install and build packages
esy

Features

  • Syntax highlighting
    • ATD
    • Cram tests
    • Dune
    • Menhir
    • Merlin
    • META
    • OCaml
    • OCamlbuild
    • OCamlFormat
    • OCamllex
    • opam
    • ReasonML
  • Indentation rules
  • Snippets
    • Dune
    • OCaml
    • OCamllex

Configuration

This extension provides options in VSCode's configuration settings. You can find the settings under File > Preferences > Settings.

Name Description Default
ocaml.sandbox Determines where to find the sandbox for a given project null

Commands

You can execute it by entering the following command at the command palette Ctrl+P.

Name Description Keyboard Shortcuts Menu Contents
ocaml.select-sandbox Select sandbox for this workspace

Requirements

About

Visual Studio Code extension for OCaml

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • OCaml 86.5%
  • JavaScript 13.0%
  • Other 0.5%