Improvements to OCaml code editing: the basics of a refactor engine
4 days ago
- #OCaml
- #Refactoring
- #Merlin
- Refactoring features enhance editor popularity and programming language usability.
- OCaml's refactoring capabilities include renaming, expression substitution, and pattern matching analysis.
- Internship focused on developing robust refactoring tools for OCaml, starting with expression extraction to toplevel.
- Expression extraction moves selected code into a new top-level let binding, improving modularity.
- Examples show extraction of constants and expressions, handling purity and variable dependencies.
- Advanced cases involve extracting expressions with free variables, generating functions to handle them.
- Real-world example demonstrates refactoring markup pretty-print logic into a separate function.
- Editor support via Language Server Protocol (LSP) includes code actions and custom requests for interactivity.
- Future plans include expanding refactoring tools and improving OCaml's editor experience.
- Open-source contributions and PRs under review aim to integrate these features into Merlin and related tools.