Skip to content

Commit 9433331

Browse files
authored
Indent further args of anonymous functions (#1440)
1 parent 8f772ba commit 9433331

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
+ Restore previous functionality for pre-post extension points (#1342, @jberdine)
1414

1515
+ Fix extra break before `function` body of a `fun` (#1343, @jberdine)
16+
Indent further args of anonymous functions (#1440, @gpetiot)
1617

1718
+ Do not clear the emacs `*compilation*` buffer on successful reformat (#1350, @jberdine)
1819

lib/Fmt_ast.ml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,10 +1851,12 @@ and fmt_expression c ?(box = true) ?pro ?epi ?eol ?parens ?(indent_wrap = 0)
18511851
( fmt_args_grouped e0 e1N $ fmt "@ "
18521852
$ fmt_label lbl ":" $ cmts_before
18531853
$ hvbox 0
1854-
( str "(fun "
1855-
$ fmt_attributes c ~key:"@" eN1.pexp_attributes
1856-
~suf:(str " ")
1857-
$ fmt_fun_args c xargs $ fmt_opt fmt_cstr
1854+
( hvbox 2
1855+
( fmt "(fun@ "
1856+
$ fmt_attributes c ~key:"@"
1857+
eN1.pexp_attributes ~suf:(str " ")
1858+
$ fmt_fun_args c xargs $ fmt_opt fmt_cstr
1859+
)
18581860
$ fmt "@ ->" ) )
18591861
$ fmt
18601862
( match xbody.ast.pexp_desc with

lib/Source.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ let extend_loc_to_include_attributes t (loc : Location.t)
153153
else
154154
let last_loc =
155155
List.fold l ~init:loc
156-
~f:(fun (acc : Location.t)
157-
({attr_name= {loc; _}; attr_payload= payload; _} :
158-
Parsetree.attribute)
156+
~f:(fun
157+
(acc : Location.t)
158+
({attr_name= {loc; _}; attr_payload= payload; _} :
159+
Parsetree.attribute)
159160
->
160161
if loc.loc_ghost then acc
161162
else

0 commit comments

Comments
 (0)