github.com/ocaml/ocaml-lsp

OCaml Language Server Protocol implementation

Open this visualization on its own page →

Contributors

41

Lines of Code

2,861

From

2019-01-28

To

2021-01-03

About ocaml/ocaml-lsp

OCaml-LSP is an implementation of the Language Server Protocol for OCaml that enables IDE integration and editor support for OCaml development. The project provides the `ocamllsp` binary, which allows text editors and IDEs to offer features like code completion, hover information, go-to-definition, refactoring, and diagnostics for OCaml code. It can be installed via opam, esy, or Dune's package management system, and integrates well with the Dune build system through RPC communication.

The server supports a comprehensive range of LSP features including semantic highlighting, document formatting, code lensing, symbol navigation, and renaming. Beyond standard LSP capabilities, OCaml-LSP provides OCaml-specific extensions such as switching between implementation and interface files, inferring interfaces, locating typed holes, and generating exhaustive pattern matching through code actions. The project also includes experimental features for constructing values by type and displaying syntax documentation on hover.

OCaml-LSP is particularly well-integrated with the Visual Studio Code platform through the OCaml Platform extension, though it works with any LSP-compatible editor. The project vendors Merlin internally to provide "smart" functionality even when source code doesn't compile, eliminating the need for users to separately install Merlin. Development is active with comprehensive test coverage and a changelog-driven contribution process.

Share this video