OCaml Editor Gets a Major Boost: Powerful Refactoring Capabilities

2025-08-20
OCaml Editor Gets a Major Boost: Powerful Refactoring Capabilities

During my internship, I added powerful refactoring capabilities to OCaml's Merlin compiler, starting with an "extract toplevel expression" feature. This feature extracts selected expressions into new `let` bindings, supporting constants and expressions (including those using variables), and cleverly handling OCaml's purity issues. Implemented via the Language Server Protocol (LSP) with both code action and custom request interaction methods, the feature is in PRs and nearing merge. This marks a significant step towards an IntelliJ-like editor experience for OCaml, with plans for more refactoring tools in the future.

Read more
Development