feat(lsp): add OCaml (ocamllsp) with beginner-friendly defaults - #19
Merged
Conversation
Wire ocaml-lsp-server through the native LSP API, matching the nil/clangd
pattern: after/lsp/ocamllsp.lua holds the config, after/ftplugin/ocaml.lua
enables it. The server is expected on PATH via opam (docs/adr/0001).
Beginner-friendly defaults for learning the language:
- inlay hints for let bindings and pattern variables, enabled
automatically on attach (other filetypes keep the global off default).
- extendedHover and syntaxDocumentation for richer hover; codelens left
off as it duplicates the inlay hints.
Formatting goes through Conform (ocaml = { "ocamlformat" }) on the existing
format-on-save path; ocamlformat no-ops without a .ocamlformat file.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Record the first ADR: provision OCaml tooling via opam and wire ocamllsp through the native LSP API, rejecting mason (switch-agnostic build) and Nix (poor fit for per-project switches). Update the Architecture and format-on-save sections to mention ocamllsp and ocamlformat. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add OCaml language support aimed at learning the language, wired through the Neovim 0.11+ native LSP API (same shape as
nil/clangd).Changes
after/lsp/ocamllsp.lua—ocamllspconfig:cmd = { "ocamllsp" }, root markers (dune-project/dune-workspace/.git), and beginner-friendly settings:on_attach(other filetypes keep the global off default;<leader>lhstill toggles).extendedHover+syntaxDocumentation;codelensintentionally off (duplicates inlay hints).after/ftplugin/ocaml.lua—vim.lsp.enable "ocamllsp".lua/plugins/conform.lua—ocaml = { "ocamlformat" }on the existing format-on-save path (no-ops without.ocamlformat).docs/adr/0001-ocaml-lsp-via-opam.md— first ADR: opam provisioning, native API, why not mason/Nix, deferred REPL.CLAUDE.md— synced Architecture + format-on-save sections.Out of repo (do separately)
Put a
.ocamlformatat the project root to enable format-on-save.Deferred (per grilling)
Verification
bin/check(lock-faithful restore): OK..mlbuffer resolvesfiletype=ocaml, theocamllspnative config (cmd=ocamllsp, inlay settings present), andvim.lsp.enableruns without error. The server itself isn't present in CI, so it simply doesn't start — no load error.🤖 Generated with Claude Code