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!

Merlin's signature-help feature, which displays function signatures and highlights the active parameter as you type, has received several improvements:

  • Parameter-only display: Signature help now only appears on function parameters, no longer on the function name itself.
  • No more parameter looping: After the last parameter, the highlight no longer wraps back to the first one.
  • Better context support: Signature help now activates within let .. in bindings even before the in keyword is written.
  • Optional parameter detection: Optional parameters are now correctly detected and highlighted when the user starts writing one.

Some of these improvements are already available in the latest Merlin and ocaml-lsp releases, with the rest coming in upcoming versions.

A preview release of Merlin 5.7-505~preview is available, intended as a preview for the OCaml 5.5 series. Highlights:

  • An Other variant in locate-types so editors can render types like 'a t -> 'a with their type variables preserved (#2025).
  • The option wrapper is stripped from optional parameters in locate-types (#2027).
  • A fix for a record field autocompletion regression caused by incomplete cache fingerprinting (#2028).
  • Signature help no longer loops back to the first parameter once all arguments have been written (#2023).

For more details, see the full changelog below.

See full backstage
  • merlin library

    • Add "Other" variant to locate-types result (#2025)
    • Don't include option in locate-types result for optional parameters (#2027)
    • Fix record field autocompletion (#2028)
    • Signature help should not loop over the parameters once it is finished (#2023)
  • tests

    • Add a reproduction case for #1214, the issue has been resolved before (#2022)
    • Add reproduction case for #1763 but it is not failing anymore (#2021)
    • Add a test to reproduce Locate command fails on multi-line type definitions (#2020)
    • Add a regression test for issue #2019 (#2030)

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.