package ocamlformat-lib

  1. Overview
  2. Docs
OCaml Code Formatter

Install

Dune Dependency

Authors

Maintainers

Sources

ocamlformat-0.26.1.tbz
sha256=da006e427f15b9ec612fb808d446599bd9b7c3ee25abeb3d555747a70d74c6d7
sha512=b7413f8dc47ba3a2372e89d59cae54f9a602ab81e31cd14ed986a831111080b79a5a3cc45dac04d8ffae5054c35bf29fe9559f145c76c87a30e191ed5400942a

doc/ocamlformat-lib/Ocamlformat_lib/Conf/index.html

Module Ocamlformat_lib.ConfSource

include module type of Conf_t
Sourcetype parsed_from = [
  1. | `File of Ocaml_common.Location.t
  2. | `Attribute of Ocaml_common.Location.t
]
Sourcetype updated_from = [
  1. | `Env
  2. | `Commandline
  3. | `Parsed of parsed_from
]
Sourcetype from = [
  1. | `Default
  2. | `Profile of Ocamlformat_stdlib.string * updated_from
  3. | `Updated of updated_from * from Ocamlformat_stdlib.option
]
Sourcemodule Error : sig ... end
Sourcemodule Elt : sig ... end
Sourcetype 'a elt = 'a Elt.t
Sourcetype 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

Sourcetype 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

Sourcetype t = {
  1. fmt_opts : fmt_opts;
  2. opr_opts : opr_opts;
  3. profile : [ `default | `conventional | `ocamlformat | `janestreet ] elt;
}
Sourceval default_profile : from -> fmt_opts
Sourceval default : t

update ?quiet c a updates configuration c after reading attribute a. quiet is false by default.

Sourceval update_value : t -> name:Ocamlformat_stdlib.string -> value:Ocamlformat_stdlib.string -> (t, Error.t) Ocamlformat_stdlib.Result.t
Sourceval update_state : t -> [ `Enable | `Disable ] -> t
Sourceval parse_state_attr : Parser_extended.Parsetree.attribute -> [ `Enable | `Disable ] Ocamlformat_stdlib.option
Sourceval parse_line : t -> ?version_check:Ocamlformat_stdlib.bool -> ?disable_conf_attrs:Ocamlformat_stdlib.bool -> from: [< `Attribute of Ocaml_common.Warnings.loc | `File of Ocaml_common.Warnings.loc ] -> Ocamlformat_stdlib.string -> (t, Error.t) Ocamlformat_stdlib.Result.t
Sourceval print_config : t -> Ocamlformat_stdlib.unit
Sourcemodule UI : sig ... end
Sourcemodule Operational : sig ... end
Sourceval term : (t -> t) Cmdliner.Term.t
OCaml

Innovation. Community. Security.