Backstage OCaml

RSS

Get updates on experimental releases, work-in-progress, and opportunities to contribute to the development of the OCaml Platform and its infrastructure.

Discuss this post on discuss!

We're excited to announce ocaml.nvim, a new Neovim plugin actively being developed by Tarides that brings advanced OCaml development features to Neovim users. Think of it as the Neovim sibling of ocaml-eglot, which we released earlier this year for Emacs users.

What is ocaml.nvim?

Modern code editors communicate with programming languages through the Language Server Protocol (LSP), which provides essential features like syntax checking, code navigation, and auto-completion. However, OCaml's language server exposes powerful custom commands beyond what generic LSP clients can access.

ocaml.nvim works alongside generic Neovim LSP plugins like nvim-lspconfig, providing direct access to advanced ocamllsp features without requiring complex editor-side logic. The plugin gives you access to all the advanced Merlin commands not supported by generic LSP clients.

Key Features

Typed Holes Navigation - Navigate between typed holes (_) and interactively substitute them with the Construct command.

Semantic Navigation - Move through your code semantically: jump between expressions, parent let bindings, modules, functions, and match expressions.

Phrase Navigation - Move between OCaml phrases (top-level definitions) in your buffer.

Many more features are in development, including alternating between .ml and .mli files, type enclosing, and pattern matching generation.

Getting Started

Installation is straightforward with lazy.nvim:

require("lazy").setup({
  { "tarides/ocaml.nvim",
    config = function()
      require("ocaml").setup()
    end
  }
})

The plugin complements your existing LSP setup—you'll continue to use Neovim's built-in LSP for standard features while ocaml.nvim adds OCaml-specific capabilities.

Project Status

The ocaml.nvim repository is now public on GitHub, with comprehensive documentation, a feature table, and screencast demonstrations. We're working towards a stable 1.0 release and welcome feedback from the community.

Try out ocaml.nvim and let us know what you think! For questions or feedback, reach out to Charlène Gros at charlene@tarides.com, join the discussion on the OCaml Discuss forum, or post an issue on the ocaml.nvim GitHub repository.

The Merlin team is excited to share that you can now try out an experimental branch of Merlin that leverages OCaml 5's domains and effects! This is Merlin-domains, and we'd love for you to test it and share your feedback.

What is Merlin-domains?

Merlin-domains is an experimental branch that uses domains and effects to implement two optimisations to improve performance in large buffers: partial typing and cancellation.

As a reminder, Merlin is the editor service that powers OCaml's IDE features—if you're using the OCaml Platform extension with VS Code or ocaml-eglot with Emacs, you're already using Merlin under the hood through OCaml LSP Server.

Why This Matters

While Merlin has had relatively few performance complaints over the years, in some contexts like very large files, the parsing-typing-analysis mechanism could sometimes cause slowdowns. The experimental branch addresses this in a clever way.

When you run an analysis command on a very large file, the type-checker will progress up to the location that makes the analysis possible, run the analysis phase, return the result, and then continue typing the file. This separation is made possible through control flow management enabled by effects, with two domains interacting with each other.

The result? Analysis phases become much more efficient! This is a great example of migrating a regular OCaml application to take advantage of multicore.

Learn More at Lambda World

Want to understand the technical details? Sonja Heinze and Carine Morel will present their talk "When magic meets multicore - OCaml and its elegant era of parallelism" at Lambda World, where they'll dive into how this experimental branch works internally.

How to Test It

Currently, the branch is in its incubation phase. To test it, pin the branch in the switches where you want to experiment:

opam pin add https://github.com/ocaml/merlin#merlin-domains

Although this experimental branch passes the test suite, your feedback is very important to help collect potential bugs we may have missed. The team has added a Bug/Merlin-domains label to organize tickets related to this branch.

What's Next

The goal is for this branch to eventually become the main branch, so that all users can benefit from these improvements. The rest of the ecosystem depending on Merlin, including OCaml LSP Server, will be adapted to take full advantage of these new features.

We need you! Try out merlin-domains with your real-world OCaml projects and share your experience on the Discuss thread. Your testing and feedback will help shape the future of Merlin!

This is a preview release that adds support for OCaml 4.10. Short-path is disabled. Other versions of OCaml are not supported.

See full backstage

Oops, we went looking but didn't find the changelog for this release 🙈

If you want to contribute to a new release announcement, check out the Contributing Guide on GitHub.