package ocamlformat-lib

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

This module contains the types of configuration options, along with small helper functions. It is separated from Conf to avoid dependency cycles.

type parsed_from = [
  1. | `File of Ocaml_common.Location.t
  2. | `Attribute of Ocaml_common.Location.t
]
type updated_from = [
  1. | `Env
  2. | `Commandline
  3. | `Parsed of parsed_from
]
type from = [
  1. | `Default
  2. | `Profile of Ocamlformat_stdlib.string * updated_from
  3. | `Updated of updated_from * from Ocamlformat_stdlib.option
]
module Error : sig ... end
module Elt : sig ... end
type 'a elt = 'a Elt.t
type fmt_opts = {
  1. align_symbol_open_paren : Ocamlformat_stdlib.bool elt;
  2. assignment_operator : [ `Begin_line | `End_line ] elt;
  3. break_before_in : [ `Fit_or_vertical | `Auto ] elt;
  4. break_cases : [ `Fit | `Nested | `Toplevel | `Fit_or_vertical | `Vertical | `All ] elt;
  5. break_collection_expressions : [ `Wrap | `Fit_or_vertical ] elt;
  6. break_colon : [ `Before | `After ] elt;
  7. break_infix : [ `Wrap | `Fit_or_vertical | `Wrap_or_vertical ] elt;
  8. break_infix_before_func : Ocamlformat_stdlib.bool elt;
  9. break_fun_decl : [ `Wrap | `Fit_or_vertical | `Smart ] elt;
  10. break_fun_sig : [ `Wrap | `Fit_or_vertical | `Smart ] elt;
  11. break_separators : [ `Before | `After ] elt;
  12. break_sequences : Ocamlformat_stdlib.bool elt;
  13. break_string_literals : [ `Auto | `Never ] elt;
    (*

    How to potentially break string literals into new lines.

    *)
  14. break_struct : Ocamlformat_stdlib.bool elt;
  15. cases_exp_indent : Ocamlformat_stdlib.int elt;
  16. cases_matching_exp_indent : [ `Normal | `Compact ] elt;
  17. disambiguate_non_breaking_match : Ocamlformat_stdlib.bool elt;
  18. doc_comments : [ `Before | `Before_except_val | `After_when_possible ] elt;
  19. doc_comments_padding : Ocamlformat_stdlib.int elt;
  20. doc_comments_tag_only : [ `Fit | `Default ] elt;
  21. dock_collection_brackets : Ocamlformat_stdlib.bool elt;
  22. exp_grouping : [ `Parens | `Preserve ] elt;
  23. extension_indent : Ocamlformat_stdlib.int elt;
  24. field_space : [ `Tight | `Loose | `Tight_decl ] elt;
  25. function_indent : Ocamlformat_stdlib.int elt;
  26. function_indent_nested : [ `Always | `Auto | `Never ] elt;
  27. if_then_else : [ `Compact | `Fit_or_vertical | `Keyword_first | `K_R | `Vertical ] elt;
  28. indent_after_in : Ocamlformat_stdlib.int elt;
  29. indicate_multiline_delimiters : [ `No | `Space | `Closing_on_separate_line ] elt;
  30. indicate_nested_or_patterns : [ `Space | `Unsafe_no ] elt;
  31. infix_precedence : [ `Indent | `Parens ] elt;
  32. leading_nested_match_parens : Ocamlformat_stdlib.bool elt;
  33. let_and : [ `Compact | `Sparse ] elt;
  34. let_binding_indent : Ocamlformat_stdlib.int elt;
  35. let_binding_deindent_fun : Ocamlformat_stdlib.bool elt;
    (*

    De-indent the fun in a let-binding body.

    *)
  36. let_binding_spacing : [ `Compact | `Sparse | `Double_semicolon ] elt;
  37. let_module : [ `Compact | `Sparse ] elt;
  38. line_endings : [ `Lf | `Crlf ] elt;
  39. margin : Ocamlformat_stdlib.int elt;
    (*

    Format code to fit within margin columns.

    *)
  40. match_indent : Ocamlformat_stdlib.int elt;
  41. match_indent_nested : [ `Always | `Auto | `Never ] elt;
  42. max_indent : Ocamlformat_stdlib.int Ocamlformat_stdlib.option elt;
  43. module_item_spacing : [ `Compact | `Preserve | `Sparse ] elt;
  44. nested_match : [ `Wrap | `Align ] elt;
  45. ocp_indent_compat : Ocamlformat_stdlib.bool elt;
    (*

    Try to indent like ocp-indent

    *)
  46. parens_ite : Ocamlformat_stdlib.bool elt;
  47. parens_tuple : [ `Always | `Multi_line_only ] elt;
  48. parens_tuple_patterns : [ `Always | `Multi_line_only ] elt;
  49. parse_docstrings : Ocamlformat_stdlib.bool elt;
  50. parse_toplevel_phrases : Ocamlformat_stdlib.bool elt;
  51. sequence_blank_line : [ `Compact | `Preserve_one ] elt;
  52. sequence_style : [ `Before | `Separator | `Terminator ] elt;
  53. single_case : [ `Compact | `Sparse ] elt;
  54. space_around_arrays : Ocamlformat_stdlib.bool elt;
  55. space_around_lists : Ocamlformat_stdlib.bool elt;
  56. space_around_records : Ocamlformat_stdlib.bool elt;
  57. space_around_variants : Ocamlformat_stdlib.bool elt;
  58. stritem_extension_indent : Ocamlformat_stdlib.int elt;
  59. type_decl : [ `Compact | `Sparse ] elt;
  60. type_decl_indent : Ocamlformat_stdlib.int elt;
  61. wrap_comments : Ocamlformat_stdlib.bool elt;
    (*

    Wrap comments at margin.

    *)
  62. wrap_docstrings : Ocamlformat_stdlib.bool elt;
  63. wrap_fun_args : Ocamlformat_stdlib.bool elt;
}

Formatting options

type opr_opts = {
  1. comment_check : Ocamlformat_stdlib.bool elt;
  2. debug : Ocamlformat_stdlib.bool elt;
    (*

    Generate debugging output if true.

    *)
  3. disable : Ocamlformat_stdlib.bool elt;
  4. margin_check : Ocamlformat_stdlib.bool elt;
    (*

    Check whether the formatted output exceeds the margin.

    *)
  5. max_iters : Ocamlformat_stdlib.int elt;
    (*

    Fail if output of formatting does not stabilize within max_iters iterations.

    *)
  6. ocaml_version : Ocaml_version.t elt;
    (*

    Version of OCaml syntax of the output.

    *)
  7. quiet : Ocamlformat_stdlib.bool elt;
  8. disable_conf_attrs : Ocamlformat_stdlib.bool elt;
  9. version_check : Ocamlformat_stdlib.bool elt;
}

Options changing the tool's behavior

type t = {
  1. fmt_opts : fmt_opts;
  2. opr_opts : opr_opts;
  3. profile : [ `default | `conventional | `ocamlformat | `janestreet ] elt;
}
OCaml

Innovation. Community. Security.