OxCaml Enhanced
First-class VS Code support for OxCaml language extensions: modal types, unboxed layouts, comprehensions, labeled tuples, and more.
Features
Syntax Highlighting
Extends the built-in OCaml grammar with OxCaml-specific constructs:
- Mode annotations:
@ local, @ shared, @ portable, @ unique, and all other mode axes
- Layout/kind annotations:
('a : float64), ('a : immediate), product layouts
- Keywords:
local_, exclave_, include functor
- Immutable arrays:
[: ... :]
- Comprehensions:
[ x for x = 1 to 10 when p x ]
- Template attributes:
let%template, [%%template: ...]
- Float32 literals:
1.0s
- Attributes:
[@zero_alloc], [%probe ...]
- Unboxed types:
float64#, int32#
ppx_expect Test Runner
Integrated test discovery and execution for Jane Street's testing frameworks:
- Discovers
let%expect_test, let%test, and let%test_unit blocks
- Per-directory test execution via
dune runtest
- Inline expected vs. actual diff view when expect tests fail
- One-click output promotion via
dune promote
- Full VS Code Test Explorer integration
Compiler Switch Management
- Auto-detects opam switches with OxCaml compiler variants
- Status bar indicator showing current switch and OxCaml status
- Configures
ocaml.server.path for the OCaml Platform extension
- Restarts the language server on switch change
Dune Build Integration
- Task provider: build, test, clean, promote, fmt
- Background watch mode (
dune build --watch)
- OCaml problem matcher for inline error reporting
UTop REPL
- Open a UTop session from the command palette
- Send selection or current block to REPL (
Ctrl+Shift+Enter)
- Syntax-aware block detection for complete
let bindings
Requirements
- OCaml Platform extension (recommended)
- opam and dune installed
- For OxCaml features: an opam switch with the OxCaml compiler (
opam switch create 5.2.0+ox)
Extension Settings
| Setting |
Default |
Description |
oxcaml.compiler.switch |
(auto-detect) |
Opam switch to use |
oxcaml.test.command |
dune runtest |
Command to run expect tests |
oxcaml.repl.command |
dune utop |
Command to start the UTop REPL |
oxcaml.telemetry.enabled |
true |
Send anonymous usage data |
Keybindings
| Key |
Command |
Ctrl+Shift+Enter |
Send selection to REPL |
About OxCaml
OxCaml is OCaml extended with modal types, unboxed layouts, stack allocation, and other features developed by Jane Street. Learn more at oxcaml.org.
License
MIT
| |