2022-02-03 13:13:35 +00:00
|
|
|
# -*- conf -*-
|
|
|
|
# This is an example configuration file for ocp-indent
|
|
|
|
#
|
|
|
|
# Copy to the root of your project with name ".ocp-indent", customise, and
|
|
|
|
# transparently get consistent indentation on all your ocaml source files.
|
|
|
|
|
|
|
|
# Starting the configuration file with a preset ensures you won't fallback to
|
|
|
|
# definitions from "~/.ocp/ocp-indent.conf".
|
|
|
|
# These are `normal`, `apprentice` and `JaneStreet` and set different defaults.
|
|
|
|
normal
|
|
|
|
|
|
|
|
#
|
|
|
|
# INDENTATION VALUES
|
|
|
|
#
|
|
|
|
|
|
|
|
# Number of spaces used in all base cases, for example:
|
|
|
|
# let foo =
|
|
|
|
# ^^bar
|
|
|
|
base = 2
|
|
|
|
|
|
|
|
# Indent for type definitions:
|
|
|
|
# type t =
|
|
|
|
# ^^int
|
|
|
|
type = 2
|
|
|
|
|
|
|
|
# Indent after `let in` (unless followed by another `let`):
|
|
|
|
# let foo = () in
|
|
|
|
# ^^bar
|
|
|
|
in = 0
|
|
|
|
|
|
|
|
# Indent after `match/try with` or `function`:
|
|
|
|
# match foo with
|
|
|
|
# ^^| _ -> bar
|
|
|
|
with = 0
|
|
|
|
|
|
|
|
# Indent for clauses inside a pattern-match (after the arrow):
|
|
|
|
# match foo with
|
|
|
|
# | _ ->
|
|
|
|
# ^^^^bar
|
|
|
|
# the default is 2, which aligns the pattern and the expression
|
|
|
|
match_clause = 2
|
|
|
|
|
|
|
|
# Indentation for items inside extension nodes:
|
|
|
|
# [%% id.id
|
|
|
|
# ^^^^contents ]
|
|
|
|
# [@@id
|
|
|
|
# ^^^^foo
|
|
|
|
# ]
|
|
|
|
ppx_stritem_ext = 2
|
|
|
|
|
|
|
|
# When nesting expressions on the same line, their indentation are in
|
|
|
|
# some cases stacked, so that it remains correct if you close them one
|
|
|
|
# at a line. This may lead to large indents in complex code though, so
|
|
|
|
# this parameter can be used to set a maximum value. Note that it only
|
|
|
|
# affects indentation after function arrows and opening parens at end
|
|
|
|
# of line.
|
|
|
|
#
|
|
|
|
# for example (left: `none`; right: `4`)
|
|
|
|
# let f = g (h (i (fun x -> # let f = g (h (i (fun x ->
|
|
|
|
# x) # x)
|
|
|
|
# ) # )
|
|
|
|
# ) # )
|
|
|
|
max_indent = 2
|
2022-02-03 13:55:17 +00:00
|
|
|
# < default = 4
|
2022-02-03 13:13:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# INDENTATION TOGGLES
|
|
|
|
#
|
|
|
|
|
|
|
|
# Wether the `with` parameter should be applied even when in a sub-block.
|
|
|
|
# Can be `always`, `never` or `auto`.
|
|
|
|
# if `always`, there are no exceptions
|
|
|
|
# if `auto`, the `with` parameter is superseded when seen fit (most of the time,
|
|
|
|
# but not after `begin match` for example)
|
|
|
|
# if `never`, `with` is only applied if the match block starts a line.
|
|
|
|
#
|
|
|
|
# For example, the following is not indented if set to `always`:
|
|
|
|
# let f = function
|
|
|
|
# ^^| Foo -> bar
|
|
|
|
strict_with = never
|
|
|
|
|
|
|
|
# Controls indentation after the `else` keyword. `always` indents after the
|
|
|
|
# `else` keyword normally, like after `then`.
|
|
|
|
# If set to `never', the `else` keyword won't indent when followed by a newline.
|
|
|
|
# `auto` indents after `else` unless in a few "unclosable" cases (`let in`,
|
|
|
|
# `match`...).
|
|
|
|
#
|
|
|
|
# For example, with `strict_else=never`:
|
|
|
|
# if cond then
|
|
|
|
# foo
|
|
|
|
# else
|
|
|
|
# bar;
|
|
|
|
# baz
|
|
|
|
# `never` is discouraged if you may encounter code like this example,
|
|
|
|
# because it hides the scoping error (`baz` is always executed)
|
|
|
|
strict_else = always
|
|
|
|
|
|
|
|
# Ocp-indent will normally try to preserve your in-comment indentation, as long
|
|
|
|
# as it respects the left-margin or starts with `(*\n`. Setting this to `true`
|
|
|
|
# forces alignment within comments.
|
|
|
|
strict_comments = false
|
|
|
|
|
|
|
|
# Toggles preference of column-alignment over line indentation for most
|
|
|
|
# of the common operators and after mid-line opening parentheses.
|
|
|
|
#
|
|
|
|
# for example (left: `false'; right: `true')
|
|
|
|
# let f x = x # let f x = x
|
|
|
|
# + y # + y
|
|
|
|
align_ops = true
|
|
|
|
|
|
|
|
# Function parameters are normally indented one level from the line containing
|
|
|
|
# the function. This option can be used to have them align relative to the
|
|
|
|
# column of the function body instead.
|
|
|
|
# if set to `always`, always align below the function
|
|
|
|
# if `auto`, only do that when seen fit (mainly, after arrows)
|
|
|
|
# if `never`, no alignment whatsoever
|
|
|
|
#
|
|
|
|
# for example (left: `never`; right: `always or `auto)
|
|
|
|
# match foo with # match foo with
|
|
|
|
# | _ -> some_fun # | _ -> some_fun
|
|
|
|
# ^^parameter # ^^parameter
|
|
|
|
align_params = auto
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# SYNTAX EXTENSIONS
|
|
|
|
#
|
|
|
|
|
|
|
|
# You can also add syntax extensions (as per the --syntax command-line option):
|
|
|
|
# syntax = mll lwt
|