-
Notifications
You must be signed in to change notification settings - Fork 200
Description
This may be an Ocaml faux pas but I prefer 4 col/character indenting. I can't find any option to indent the contents of modules, module signatures or module types.
Here is what ocamlformat currently outputs by default:
module IndentMe : sig
type t
type indent
val indent_me : t -> int -> indent
end
module type IndentMe = sig
type t
type indent
val indent_me : t -> int -> indent
end
module IndentMe = struct
type t
type indent
let indent_me = failwith ""
end
module IndentMe : sig
type t
type indent
val indent_me : t -> int -> indent
end = struct
type t = int
type indent = int
let indent_me = failwith ""
end
What I would prefer instead is this (with 4-character indentation inside modules):
module IndentMe : sig
type t
type indent
val indent_me : t -> int -> indent
end
module type IndentMe = sig
type t
type indent
val indent_me : t -> int -> indent
end
module IndentMe = struct
type t
type indent
let indent_me = failwith ""
end
module IndentMe : sig
type t
type indent
val indent_me : t -> int -> indent
end = struct
type t = int
type indent = int
let indent_me = failwith ""
end
ocp-indent does not seem to provide this either. I was hopeful that adding base = 4
to the .ocp-indent config would help but it doesn't.
I'd love to see support for configuring the indentation width of modules, module types, and signatures. Ideally, this could be done with either:
- A general option like module-indent = COL, or
- More specific options like module-type-indent = COL, module-sig-indent = COL, etc.
This indentation level would then apply to all items inside the respective module-related structures (and be recursive for submodules).
Apologies in advance if this is already provided.