We're happy to announce the release of ocaml-lsp-server 1.24.0, which brings support for OCaml 5.4!
For more details, see the related announcement on the Discuss forums!
Official stable release announcements and updates from the OCaml compiler, OCaml infrastructure and the OCaml Platform Tools.
We're happy to announce the release of ocaml-lsp-server 1.24.0, which brings support for OCaml 5.4!
For more details, see the related announcement on the Discuss forums!
We're happy to announce the release of ocaml-lsp-server 1.23.1!
This maintenance release fixes three key issues:
.mll (OCamllex lexer) files in editors like NeoVimUpdate via opam: opam update && opam upgrade ocaml-lsp-server
For more details, see the related announcement on the Discuss forums!
ocaml-eglot provides full OCaml language support in Emacs through the Language Server Protocol (LSP) instead of direct Merlin integration. It offers the same features as merlin.el with simplified setup and enhanced capabilities like project-wide search. If you're starting fresh or want a more standardized approach, try ocaml-eglot, which is actively maintained. If your current merlin.el setup works well, you can continue using it.
Quick start: Install ocaml-lsp-server, add ocaml-eglot to your Emacs config, and get the same OCaml development experience with less configuration.
ocaml-eglot connects Emacs to ocaml-lsp-server using the Language Server Protocol, providing a standardized way to get OCaml language support.
Since the recent versions of Emacs (29), eglot, an LSP client, has been shipped with Emacs. However, merlin.el provides more features than LSP (which is designed to be generic), so relying solely on the features of LSP and eglot would limit functionality. Thus, we extended the LSP server to support more features, and ocaml-eglot allows you to benefit from these features in Emacs.
ocaml-eglot is a minor mode. It therefore works in conjunction with a major mode to edit Caml code. Examples of major modes include tuareg, caml-mode and the recent neocaml.
Use ocaml-eglot if you:
If your current setup is working perfectly and is heavily customised, merlin.el will still keep working, so there's no immediate need to migrate. However, for the moment, we don't plan to actively maintain merlin.el -- unless we receive a lot of requests.
Follow the installation instructions in the ocaml-eglot README.
When migrating from merlin.el to ocaml-eglot, your existing keybindings should work immediately!
Error Navigation: Quick jump to next/previous errors
Type Information: Display types under cursor with adjustable verbosity, navigate enclosing expressions
Code Generation: Pattern matching construction, case completion, wildcard refinement via "destruct" feature
Navigation: Jump between language constructs (let, module, function, match), navigate phrases and pattern cases
Search: Find definitions, declarations, and references
For a detailed list of features, see the ocaml-eglot README.
ocaml-eglotOn January 17, 2025, ocaml-eglot version 1.0.0 was released, providing a new minor emacs mode to enable the editor features provided by ocaml-lsp-server. Subsequent releases 1.1.0 and 1.2.0 enable support for flycheck as a configurable alternative to flymake (1.0.0 release), Emacs 30.1 support, better user experience and error handling, as well as support for new features.
We are excited to share the release of OCaml-LSP 1.20.1, which introduces powerful new features and vital bug fixes to improve your development workflow. The new typeSearch request allows you to find values by type signature or polarity, making it easier to locate the functionality you need. Configurable MerlinJump actions and the custom jump request give you more control over code navigation. On the bug fix side, we have tackled issues like file descriptor leaks, enhanced method completion, and cleaned up duplicate responses in selectionRange.
ocamllsp/typeSearch request (#1369)ocamllsp/jump request (#1374)merlinJumpCodeActions configuration option. Alternatively, a custom request is provided for ad hoc use of the feature. (#1411)selectionRange answers (#1368)This release introduces Merlin 5.3-502, compatible with OCaml 5.2, and 4.18-414, compatible with OCaml 4.14. Key updates include EXCLUDE_QUERY_DIR for better file management, resolving exceptions in polarity search,
and stabilizing type-enclosing results. For users of 5.3-502, additional enhancements address path resolution issues, fixes jump to fun functionality, and ensure proper handling of occurrences from hidden source files.
merlin binary
merlin binary (only in 5.3-502)
We are happy to announce the joint release of Merlin 5.2.1-502 and 4.17.1. This release adds many new features to Merlin including the ability to add hints to a source tree, serch for values using a type signature and expanding PPX annotations to preview their source code. There are also bug fixes for both the Merlin binary and editor modes.
More information can be found in the Discuss announcement.
Contributions are always welcome at Merlin | Issues
-unboxed-types and -no-unboxed-types as OCaml ignored flags (ocaml/merlin#1795, fixes ocaml/merlin#1794)expand-node command for expanding PPX annotations (ocaml/merlin#1745)inlay-hints command for adding hints on a source tree (ocaml/merlin#1812)search-by-type command for searching values by types (ocaml/merlin#1828)dot-merlin-reader ignoring SOURCE_ROOT and STDLIB directives (ocaml/merlin#1839, ocaml/merlin#1803)merlin.py (ocaml/merlin#1798)merlin-search-by-type, merlin-search-by-polarity and change the behaviour of merlin-search to switch between by-type or by-polarity depending on the query (ocaml/merlin#1828)We are pleased to announce the release of OCaml LSP 1.19.0. This version brings official support for OCaml 5.2. It also includes a new custom query to get
documentation and a fix regarding the handling of OCamlFormat processes.
ocamllsp/getDocumentation request (ocaml/ocaml-lsp#1336)sigterm rather than sigint or sigkill (ocaml/ocaml-lsp#1343)We are pleased to announce the release of OCaml LSP 1.18.0. This version comes with a lot of fixes and new features.
Notable features that are included in this release are:
TypeEnclosingifthenelse expressions...and many fixes to a handful of issues.
Feedback is very much welcomed on the the Discuss Announcement post and do not hesistate to report issues in the issue tracker.
Introduce a configuration option to control Dune diagnostics. The option is called duneDiganostics, and it may be set to { enable: false } to disable diagnostics. (ocaml/ocaml-lsp#1221)
Support folding of ifthenelse expressions (ocaml/ocaml-lsp#1031)
Improve hover behavior (ocaml/ocaml-lsp#1245)
Hovers are no longer displayed on useless parse tree nodes such as keywords, comments, etc.
Multiline hovers are now filtered away.
Display expanded PPXs in the hover window.
Improve document symbols (ocaml/ocaml-lsp#1247)
Use the parse tree instead of the typed tree. This means that document symbols will work even if the source code doesn't type check.
Include symbols at arbitrary depth.
Differentiate functions / types / variants / etc.
This now includes PPXs like let%expect_test or let%bench in the outline.
Introduce a destruct-line code action. This is an improved version of the
old destruct code action. (ocaml/ocaml-lsp#1283)
Improve signature inference to only include types for elements that were absent from the signature. Previously, all signature items would always be inserted. (ocaml/ocaml-lsp#1289)
Add an update-signature code action to update the types of elements that
were already present in the signature (ocaml/ocaml-lsp#1289)
Add custom
ocamllsp/merlinCallCompatible
request (ocaml/ocaml-lsp#1265)
Add custom ocamllsp/typeEnclosing request (ocaml/ocaml-lsp#1304)
Detect document kind by looking at Merlin's suffixes config.
This enables more LSP features for non-.ml/.mli files. Though it still
depends on Merlin's support. (ocaml/ocaml-lsp#1237)
Correctly accept the --clientProcessId flag. (ocaml/ocaml-lsp#1242)
Disable automatic completion and signature help inside comments (ocaml/ocaml-lsp#1246)
Includes a new optional/configurable option to toggle syntax documentation. If toggled on, allows display of syntax documentation on hover tooltips. Can be controlled via environment variables and by GUI for VS code. (ocaml/ocaml-lsp#1218)
For completions on labels that the LSP gets from Merlin, take into account
whether the prefix being completed starts with ~ or ?. Change the label
completions that start with ? to start with ~ when the prefix being
completed starts with ~. (ocaml/ocaml-lsp#1277)
Fix document syncing (ocaml/ocaml-lsp#1278, ocaml/ocaml-lsp#1280, fixes ocaml/ocaml-lsp#1207)
Stop generating inlay hints on generated code (ocaml/ocaml-lsp#1290)
Fix parenthesising of function types in SignatureHelp (ocaml/ocaml-lsp#1296)
Fix syntax documentation rendering (ocaml/ocaml-lsp#1318)
We are pleased to announce the release of Merlin 5.1-502. This is an important release that brings a lot of backend changes and a major
new feature: project-wide occurrences queries.
Try it by running dune build @ocaml-index (since dune 3.16.0) and performing a reference query!
More information can be found in the discuss announcement and the wiki.
Merlin_lib.index_formatSOURCE_ROOT that is used to resolve relative paths found in the
indexes.INDEX that is used to declare the list of index files Merlin should
use when looking for occurrences.UNIT_NAME configuration directive that can be used to tell Merlin
the correct name of the current unit in the presence of wrapping (ocaml/merlin#1776)merlin-lib.commands: Add a find_command_opt alternative to
find_command that does not raise (ocaml/merlin#1778)We are pleased to announce the release of Merlin 4.16-414 and 4.16-501.
These releases expose additional functions for packages using merlin-lib that need to manually parse merlin commands.
merlin-lib.commands library which disassociates the
execution of commands from the new_protocol, from the binary, allowing
it to be invoked from other projects (ocaml/merlin#1758)merlin-lib.commands: Add a find_command_opt alternative to
find_command that does not raise (ocaml/merlin#1778)We are pleased to announce the release of Merlin 4.15-414 and 4.15-501.
These releases bring a handful of bug fixes and improvements, notably to the
destruct feature, that were already released for OCaml 5.2 in Merlin 5.0-502.
We are pleased to announce the release of Merlin 5.0-502!
This release brings official support for OCaml 5.2. Substantial backend changes were required to adapt to this release, especially for features such as occurrences and get-documentation. Do not hesitate to report any suspicious behavior in the issue tracker!
This release also fixes a handful of issues, two of them improving the behaviour of Merlin's destruct feature.
destruct: Removal of residual patterns (#1737, fixes #1560)merlin-lib.commands library that disassociates the
execution of commands from the new_protocol, from the binary, allowing
it to be invoked from other projects (#1758)merlin.hide
attribute is present. (#1768)uid_to_decl table in 5.2's CMT files to get documentation.
(#1773)We're thrilled to announce the release of Merlin 4.14, a significant update that introduces a suite of enhancements and fixes to improve your OCaml editor experience.
In addition to the improvements and bug fixes in this release, Merlin 4.14 is the first version to support the upcoming OCaml 5.2 compiler.
Some highlights in this release include:
Happy coding!
FLG -pp ppx.exe -as-pp/-dump-ast use of invalid shell redirection when
direct process launch on Windows. (#1723, fixes #1722)ocamlmerlin responses to detect server crashes (#1716)module-type (#1728, partially fixes #1656)We are pleased to announce the release of OCaml LSP 1.17.0. This version comes packed with fixes and new features.
Notable features that come in this release include:
in keyword completing to other terms in the editor, we've added auto-completion for this keyword in OCaml LSP. Typing in will now only suggest auto completion for the in keyword.--fallback-read-dot-merlin flag is on. (#1173)in (#1217)We're happy to announce the release of Merlin 4.13. This release comes with a number of bug fixes to the Merlin binary.
It also introduces a new -cache-lifespan flag that can be used to set cache invalidation periods. This flag allows for fine-tuning of cache invalidation periods, enabling users to customize Merlin's internal configurations for optimal performance in various project contexts.
Additionally, this release includes several improvements in editor modes. For more details, we encourage you to delve into the full changelog.
-cache-lifespan flag, that sets cache invalidation period. (#1698,
#1705)Merlin 4.12 is a small patch release fixing regressions introduced in previous versions.
We are pleased to announce the release of Merlin 4.11 for OCaml 4.14.1, 5.0, and 5.1.
This release brings official support for OCaml 5.1 and introduces some changes to Emacs' default bindings proposed by the community:
tuareg-eval-region) and bind
C-c C-v instead to merlin-error-check;merlin-document and bind C-c M-d and
C-c | instead to merlin-destruct;merlin-type-expr.Thanks to everyone involved!
tuareg-eval-region) and bind C-c C-v instead to merlin-error-check;
rebind C-c C-d to merlin-document and bind C-c M-d and C-c | instead to merlin-destruct;
bind C-u C-c C-t to merlin-type-expr.defadvice macro (ocaml/merlin#1675)We're thrilled to announce the release of Merlin 4.10, which comes with many bug fixes and improvements.
One of the standout features of this release is the significantly enhanced
support for binding operators like let+ and and+. You'll find that the
results from type-enclosing on expressions that contain let bindings are now
more precise.
construct command (#1618). Prefixes are still produced when
warning 42 (disambiguated name) is active.short-path from looping in some cases related to recursive type
definitions (#1645)type-enclosing on let/and operators (#1653)merlin-construct-with-local-values (#1644)We've released OCaml LSP 1.16.2 with a fix that was introduced in 1.16.1 that prevented users from using preprocessor such as CPPO.
We're thrilled to announce the release of OCaml LSP 1.16.1! 🎉
This release comes with new "Extract local" and "Extract function" code actions to easily refactor your code.
We've also disabled code lenses by default following user feedback. You can follow the discussion on GitHub.
This release is also the first OCaml LSP release to use upstream Merlin. Among other things, this means that it is compatible with all the OCaml versions supported by Merlin: currently OCaml 4.14 and 5.0.0.
We're also releasing numerous bug fixes, including:
And much more! Read the full changelog for a complete list of improvements and bug fixes.
didChangeConfiguration notification (#1103)merlin-lib 4.9 (#1070)Support building with OCaml 5.0 and 5.1 (#1150)
Disable code lens by default. The support can be re-enabled by explicitly setting it in the configuration. (#1134)
Fix initilization of ocamlformat-rpc in some edge cases when ocamlformat is
initialized concurrently (#1132)
Kill unnecessary $ dune ocaml-merlin with SIGTERM rather than SIGKILL
(#1124)
Refactor comment parsing to use odoc-parser and cmarkit instead of
octavius and omd (#1088)
This allows users who migrated to omd 2.X to install ocaml-lsp-server in the same opam switch.
We also slightly improved markdown generation support and fixed a couple in the generation of inline heading and module types.
Allow opening documents that were already open. This is a workaround for neovim's lsp client (#1067)
Disable type annotation for functions (#1054)
Respect codeActionLiteralSupport capability (#1046)
Fix a document syncing issue when utf-16 is the position encoding (#1004)
Disable "Type-annotate" action for code that is already annotated. (#1037, fixes #1036)
Fix semantic highlighting of long identifiers when using preprocessors (#1049, fixes #1034)
Fix the type of DocumentSelector in cram document registration (#1068)
Accept the --clientProcessId command line argument. (#1074)
Accept --port as a synonym for --socket. (#1075)
Fix connecting to dune rpc on Windows. (#1080)
We are pleased to announce the release of Merlin 4.9 for OCaml 4.14.1 and 5.0.
This maintenance release brings multiple bug fixes and improvements. In particular we identified and patched an important memory consumption issue that could greatly affect Merlin’s performance in heavily functorized projects.
scope option to the occurrences command in preparation for
the upcoming project-wide-occurrences feature (#1596)false instead of true in the
construct command, for consistency (#1599).construct results ordering for sum types sand poly variants (#1603)errors to erroneously alert about missing
cmi files (#1577)merlin-construct (#1598)construct ordering (#1603)We are pleased to announce the release of Merlin 4.8 for OCaml 4.14.1 and 5.0.
This maintenance release brings multiple bug fixes and improvements to document fetching, jump-to-definition and type-on-hover for records' labels.
On behalf of the ocaml-lsp team, I’m pleased to announce ocaml-lsp-server versions 1.15.0-4.14 and 1.15.0-5.0 for OCaml 4.14 and 5.0, respectively. This is the first time we release ocaml-lsp supporting two compiler versions. We look forward to your feedback.
Enable semantic highlighting support by default (#933)
Support connecting over pipes and socket. Pipes on Windows aren't yet supported (#946)
More about communication channels in LSP specification.
Re-enable ocamlformat-rpc for formatting code snippets (but not files and
not on Windows) (#920, #939)
One needs to have installed either ocamlformat package version > 0.21.0 or,
otherwise, ocamlformat-rpc package. Note that previously ocamlformat-rpc
came in a standalone OPAM package, but since ocamlformat version > 0.21.0,
it comes within ocamlformat package.
Add custom ocamllsp/hoverExtended request (#561)
Support utf-8 position encoding clients (#919)
More about position encoding in LSP specification.
Show unwrapped module alias types on hovering over module names. This is due
to upgrading to merlin 4.7 and using merlin's verbosity=smart by default
(#942)
Respect the client's completion item resolve and preSelect capabilities (#925, #936)
Disable polling for dune's watch mode on Windows and OCaml 4.14.0 (#935)
Fix semantic highlighting of "long identifiers," e.g., Foo.Bar.x (#932)
Fix syncing of document contents:
Oops, we went looking but didn't find the changelog for this release 🙈
(??) custom prefix operator.
(#1507, fixes #1506)enclosing command result (#1512)verbosity=smart mode for type enclosing that only expand
modules' types (#1374, @ulugbekna)enclosing command (#1512)Fix random requests failing after switching documents (#904, fixes #898)
Do not offer related diagnostic information unless the user enables in client capabilities (#905)
Do not offer diagnostic tags unless the client supports them (#909)
Do not attach extra data to diagnostics unless the client supports this (#910)
Use /bin/sh instead of /bin/bash. This fixes ocamllsp on NixOS
Fix various server crashes when opening non OCaml/Reason files. Files such as dune, cram, etc. would cause the server to crash. (#884, fixes #871)
Ignore unknown tags in merlin configuration to improve forward compatibility with Dune. (#883)
On behalf of the ocamllsp team, I'm pleased to announce version 1.14.0. This release contains a new code action to help you inline definitions thanks to @jfeser. We look forward to your feedback.
Code action for inlining let bindings within a module or expression. (#847)
Tag "unused code" and "deprecated" warnings, allowing clients to better display them. (#848)
Refresh merlin configuration after every dune build in watch mode (#853)
Respect showDocument capabilities. Do not offer commands or code actions
that rely on this request without client support. (#836)
Fix signatureHelp on .mll files: avoid "Document.dune" exceptions
.ml, .mli, etc.) (#795)Allow cancellation of workspace symbols requests (#777)
Fix unintentionally interleaved jsonrpc IO that would corrupt the session (#786)
Ignore SIGPIPE . (#788)
Fix a bad interaction between inferred interfaces and promotion code actions in watch mode (#753)
Fix URI parsing (#739 fixes #471 and #459)
Oops, we went looking but didn't find the changelog for this release 🙈
merlin-lib package that exposes merlin's internals and the merlin
package with the frontend. (#1448, #1455, #1457, #1497, @rgrinberg,
@tmattio, @kit-ty-kate)Seq-based API of Yojson 2.0, avoiding the need for the
deprecated Stream module (#1475 by @Leonidas-from-XIV)MERLIN_LOG (#1480 by @ulugbekna)type-enclosing results (#1483, fixes #1477)core_type (#1484)merlin-locate optional, both for
consistency with Emacs convention and for backwards compatibility. (#1476,
@antalsz)Fix preprocessing, ppx, and reason support (#735 fixes #696, #706)
Support include in folding ranges (#730)
Fix cancellation mechanism for all requests (#707)
Allow cancellation of formatting requests (#707)
Add --fallback-read-dot-merlin to the LSP Server (#705). If ocamllsp is
started with this new flag, it will fall back to looking for Merlin
configuration in .merlin files rather than calling dune ocaml-merlin.
(#705)
Support folding more ranges (#692)
Fix process termination. Once the lsp server is stepped, the process will gracefully terminate (#697, fixes #694)
Forward stderr from dune's merlin configuration to the lsp server's stderr (#697)
Fix bug with large buffers being resized incorrectly in Lev
Add folding ranges for more AST types (#680)
Fix Uri handling on Windows
Fix build on MSVC 2015
On behalf of the ocamllsp team, I’m excited to announce the availability of version 1.11.0. This release is an important milestone for the project because it introduces integration with our favorite build system. When you run dune in watch mode, you will now be able to see build errors in the diagnostics panel of your editor. It’s all rather experimental for now, so your feedback and bug reports are appreciated.
As usual, the full change log is below.
Happy hacking.
Add support for dune in watch mode. The lsp server will now display build errors in the diagnostics and offer promotion code actions.
Re-introduce ocamlformat-rpc (#599, fixes #495)
= syntax in compiler flags (#1409)MerlinTypeOf (#1433 by @ddickstein, fixes
#1221)*merlin-errors* containing the last viewed error
(#1414, @panglesd)merlin-wrapper create a default .merlin file only when there is
no dune-project to let tests use dune ocaml-merlin reader. (#1425)Catch merlin desturct exceptions (#626)
Fix broken debouncing (#627)