package ocamlformat-mlx-lib

  1. Overview
  2. Docs

Description

OCamlFormat is a tool to automatically format OCaml .mlx code in a uniform style.

Published: 15 Nov 2024

README

README.md

ocamlformat

OCaml Code Formatter.

OCaml-CI Build Status

ocamlformat is a code formatter for OCaml. It comes with opinionated default settings but is also fully customizable to suit your coding style.

  • Profiles: ocamlformat offers profiles we predefined formatting configurations. Profiles include default, ocamlformat, janestreet.

  • Configurable: Users can change the formatting profile and configure every option in their .ocamlformat configuration file.

  • Format Comments: ocamlformat can format comments, docstrings, and even code blocks in your comments.

  • RPC: ocamlformat provides an RPC server that can bed used by other tools to easily format OCaml Code.

ocamlformat is part of the OCaml Platform, the recommended set of tools for OCaml.

Getting Started

Installation

To use ocamlformat, you will need OCaml and opam (the OCaml package manager) installed on your system. Visit the OCaml.org installation page for instructions.

With OCaml and opam installed, you can install ocamlformat with:

opam install ocamlformat

Usage

Formatting your code is as easy as running:

ocamlformat file.ml

To configure ocamlformat to your liking, create an .ocamlformat configuration file in your project with settings like:

profile = default
version = 0.26.2

Refer to our documentation or use ocamlformat --help for a full list of configuration options.

To make formatting your code even easier, use the dune build system:

dune fmt

Documentation

The full documentation for ocamlformat, including comprehensive user and API guides, can be found on OCaml.org.

Contributing

Contributing Guide

We wholeheartedly welcome contributors! To start, please read our Contributing Guide to familiarize yourself with our development process, including how to propose and how to start hacking on ocamlformat.

Hacking Guide

In addition to the Contributing Guide, we provide a Hacking Guide for ocamlformat developers. It contains in-depth explanation of development processes, such as running tests, releasing ocamlformat, etc.

Code of Conduct

In order to foster a welcoming and respectful community, ocamlformat has adopted the OCaml Code of Conduct.

Roadmap

Interested in the future of ocamlformat? Take a look at our Roadmap to understand our vision and planned advancements for ocamlformat.

Discussions

For conversations on ongoing development, be sure to visit the ocamlformat section of the OCaml Discuss forum.

License

ocamlformat is distributed under the terms of the MIT License. See the LICENSE file for complete details.

Acknowledgments

We gratefully acknowledge the individuals and organizations that have significantly contributed to ocamlformat.

ocamlformat owes its existance to its initial author, Josh Berdine. We also want to express our appreciation to Hugo Heuzard, Guillaume Petiot, and Jules Aguillon. Their significant contributions have been instrumental to the advancement of ocamlformat.

Moreover, our gratitude extends to Facebook, who fostered the inception of ocamlformat as part of their work on the ReasonML project. Jane Street and Tarides have also provided financial support and contributed to the ongoing development of the project.

Dependencies (18)

  1. camlp-streams
  2. result
  3. astring
  4. csexp >= "1.4.0"
  5. uutf >= "1.0.1"
  6. uuseg >= "10.0.0"
  7. stdio
  8. ocaml-version >= "3.5.0"
  9. menhirSdk >= "20201216"
  10. menhirLib >= "20201216"
  11. menhir >= "20201216"
  12. fpath
  13. fix
  14. either
  15. dune-build-info
  16. dune >= "2.8"
  17. base >= "v0.12.0"
  18. ocaml >= "4.08" & < "5.3"

Dev Dependencies (4)

  1. odoc with-doc
  2. ocp-indent with-test = "false" & >= "1.8.0" | with-test & >= "1.8.1"
  3. ocamlformat-rpc-lib with-test & = version
  4. alcotest with-test & >= "1.3.0"

Used by (1)

  1. ocamlformat-mlx

Conflicts

None

OCaml

Innovation. Community. Security.