package ocp-indent-nlfork

  1. Overview
  2. Docs
type threechoices =
  1. | Always
  2. | Never
  3. | Auto
type t = {
  1. i_base : int;
  2. i_type : int;
  3. i_in : int;
  4. i_with : int;
  5. i_match_clause : int;
  6. i_ppx_stritem_ext : int;
  7. i_max_indent : int option;
  8. i_strict_with : threechoices;
  9. i_strict_else : threechoices;
  10. i_strict_comments : bool;
  11. i_align_ops : bool;
  12. i_align_params : threechoices;
}

See the man function to get the details of what the options are supposed to do (or the template .ocp-indent)

Documentation of the indentation options, in the Cmdliner 'Manpage.block' format

type man_block = [
  1. | `S of string
  2. | `P of string
  3. | `Pre of string
  4. | `I of string * string
  5. | `Noblank
  6. | `Blocks of man_block list
]
val man : man_block list
val default : t
val update_from_string : ?extra:(string -> (string -> unit) option) -> t -> string -> t

String format is "option=value,option2=value,...". Commas can be replaced by newlines. Use ?extra to handle extra options (by side-effects only)

val to_string : ?sep:string -> t -> string

sep should be comma or newline if you want to reparse. Comma by default

val load : ?indent:t -> string -> t * string list * [ `Mod of string | `Pkg of string ] list

Load from the given filename, optionally updating from the given indent instead of the default one. On error, returns the original indent config unchanged and prints a message to stderr. The file may also contain bindings of the form 'syntax=SYNTAX_EXTENSION,...', that are returned as a the list of their names

val save : t -> string -> bool

Save the given indent config to the given filename; returns true on success

val find_conf_file : string -> string option

Looks in given and parent directories for a .ocp-indent configuration file

val local_default : ?path:string -> unit -> t * string list * [ `Mod of string | `Pkg of string ] list

Returns the local default configuration, obtained from (in order), the built-in default, the file ~/.ocp/ocp-indent.conf, a file .ocp-indent in the current directory or any parent, and the environment variable OCP_INDENT_CONFIG. Returns the list of syntax extensions that may have been activated in conf-files as well

OCaml

Innovation. Community. Security.