forked from ocaml-ppx/ocamlformat
-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathConf.mli
126 lines (115 loc) · 4.92 KB
/
Conf.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
(**************************************************************************)
(* *)
(* OCamlFormat *)
(* *)
(* Copyright (c) Facebook, Inc. and its affiliates. *)
(* *)
(* This source code is licensed under the MIT license found in *)
(* the LICENSE file in the root directory of this source tree. *)
(* *)
(**************************************************************************)
(** Configuration options *)
(** Formatting options *)
type t =
{ align_cases: bool
; align_constructors_decl: bool
; align_variants_decl: bool
; assignment_operator: [`Begin_line | `End_line]
; break_before_in: [`Fit_or_vertical | `Auto]
; break_cases: [`Fit | `Nested | `Toplevel | `Fit_or_vertical | `All]
; break_collection_expressions: [`Wrap | `Fit_or_vertical]
; break_infix: [`Wrap | `Fit_or_vertical]
; break_infix_before_func: bool
; break_fun_decl: [`Wrap | `Fit_or_vertical | `Smart]
; break_fun_sig: [`Wrap | `Fit_or_vertical | `Smart]
; break_separators: [`Before | `After]
; break_sequences: bool
; break_string_literals: [`Auto | `Never]
(** How to potentially break string literals into new lines. *)
; break_struct: bool
; cases_exp_indent: int
; cases_matching_exp_indent: [`Normal | `Compact]
; comment_check: bool
; disable: bool
; disambiguate_non_breaking_match: bool
; doc_comments: [`Before | `Before_except_val | `After_when_possible]
; doc_comments_padding: int
; doc_comments_tag_only: [`Fit | `Default]
; dock_collection_brackets: bool
; exp_grouping: [`Parens | `Preserve]
; extension_indent: int
; field_space: [`Tight | `Loose | `Tight_decl]
; function_indent: int
; function_indent_nested: [`Always | `Auto | `Never]
; if_then_else: [`Compact | `Fit_or_vertical | `Keyword_first | `K_R]
; indent_after_in: int
; indicate_multiline_delimiters: [`No | `Space | `Closing_on_separate_line]
; indicate_nested_or_patterns: [`Space | `Unsafe_no]
; infix_precedence: [`Indent | `Parens]
; leading_nested_match_parens: bool
; let_and: [`Compact | `Sparse]
; let_binding_indent: int
; let_binding_spacing: [`Compact | `Sparse | `Double_semicolon]
; let_module: [`Compact | `Sparse]
; line_endings: [`Lf | `Crlf]
; margin: int (** Format code to fit within [margin] columns. *)
; match_indent: int
; match_indent_nested: [`Always | `Auto | `Never]
; max_indent: int option
; max_iters: int
(** Fail if output of formatting does not stabilize within
[max_iters] iterations. *)
; module_item_spacing: [`Compact | `Preserve | `Sparse]
; nested_match: [`Wrap | `Align]
; ocaml_version: Ocaml_version.t
; ocp_indent_compat: bool (** Try to indent like ocp-indent *)
; parens_ite: bool
; parens_tuple: [`Always | `Multi_line_only]
; parens_tuple_patterns: [`Always | `Multi_line_only]
; parse_docstrings: bool
; quiet: bool
; sequence_blank_line: [`Compact | `Preserve_one]
; sequence_style: [`Before | `Separator | `Terminator]
; single_case: [`Compact | `Sparse]
; space_around_arrays: bool
; space_around_lists: bool
; space_around_records: bool
; space_around_variants: bool
; stritem_extension_indent: int
; type_decl: [`Compact | `Sparse]
; type_decl_indent: int
; wrap_comments: bool (** Wrap comments at margin. *)
; wrap_fun_args: bool }
val default_profile : t
type file = Stdin | File of string
type input = {kind: Syntax.t; name: string; file: file; conf: t}
type action =
| In_out of input * string option
(** Format input file (or [-] for stdin) of given kind to output file,
or stdout if None. *)
| Inplace of input list (** Format in-place, overwriting input file(s). *)
| Check of input list
(** Check whether the input files already are formatted. *)
| Print_config of t (** Print the configuration and exit. *)
| Numeric of input * (int * int)
(** Options changing the tool's behavior *)
type opts =
{ debug: bool (** Generate debugging output if true. *)
; margin_check: bool
(** Check whether the formatted output exceeds the margin. *) }
val action : unit -> (action * opts) Cmdliner.Term.result
(** Formatting action: input type and source, and output destination. *)
val update : ?quiet:bool -> t -> Extended_ast.attribute -> t
(** [update ?quiet c a] updates configuration [c] after reading attribute
[a]. [quiet] is false by default. *)
val update_value :
t
-> name:string
-> value:string
-> ( t
, [ `Bad_value of string * string
| `Malformed of string
| `Misplaced of string * string
| `Unknown of string * string ] )
Result.t
val print_config : t -> unit