Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Commit 070fccd

Browse files
committed
elbrujohalcon.otp_formatter.update- Get all formatters to work on OTP26
1 parent 8ffc18b commit 070fccd

File tree

9 files changed

+24
-12
lines changed

9 files changed

+24
-12
lines changed

.github/workflows/erlang.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313

1414
strategy:
1515
matrix:
16-
otp: ['25']
16+
otp: ['26']
1717
rebar: ['3.24']
1818

1919
steps:

rebar.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
{rebar3_sheldon, "~> 0.4.3"},
1919
{rebar3_ex_doc, "~> 0.2.24"}]}.
2020

21-
{dialyzer, [{warnings, [no_return, unmatched_returns, error_handling, underspecs]}]}.
21+
{dialyzer,
22+
[{warnings, [no_unknown, no_return, unmatched_returns, error_handling, underspecs]}]}.
2223

2324
{edoc_opts, [{todo, true}, {overview, "priv/overview.edoc"}]}.
2425

src/formatters/default_formatter.erl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,11 @@ lay_no_comments(Node, Ctxt) ->
606606
prettypr:beside(
607607
prettypr:text("<= "), D2)],
608608
Ctxt1#ctxt.break_indent);
609+
map_generator ->
610+
Ctxt1 = reset_prec(Ctxt),
611+
D1 = lay(erl_syntax:map_generator_pattern(Node), Ctxt1),
612+
D2 = lay(erl_syntax:map_generator_body(Node), Ctxt1),
613+
prettypr:par([D1, prettypr:beside(prettypr:text("<- "), D2)], Ctxt1#ctxt.break_indent);
609614
implicit_fun ->
610615
D = lay(erl_syntax:implicit_fun_name(Node), reset_prec(Ctxt)),
611616
prettypr:beside(lay_text_float("fun "), D);
@@ -621,6 +626,12 @@ lay_no_comments(Node, Ctxt) ->
621626
D2 = lay_items(erl_syntax:binary_comp_body(Node), Ctxt1, fun lay/2),
622627
D3 = prettypr:beside(lay_text_float("|| "), prettypr:beside(D2, lay_text_float(" >>"))),
623628
prettypr:beside(lay_text_float("<< "), prettypr:par([D1, D3]));
629+
map_comp ->
630+
Ctxt1 = reset_prec(Ctxt),
631+
D1 = lay(erl_syntax:map_comp_template(Node), Ctxt1),
632+
D2 = lay_items(erl_syntax:map_comp_body(Node), Ctxt1, fun lay/2),
633+
D3 = prettypr:beside(lay_text_float("|| "), prettypr:beside(D2, lay_text_float("}"))),
634+
prettypr:beside(lay_text_float("#{"),prettypr:par([D1, D3]));
624635
macro ->
625636
%% This is formatted similar to a normal function call or a variable
626637
N = macro_name(Node, variable),

test_app/after/src/brackets.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-module(brackets).
22

3-
-format #{inline_items => all, paper => 50}.
3+
-format #{paper => 50, inline_items => all}.
44

55
-compile(export_all).
66

test_app/after/src/inline_items/inline_items_when_over.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%% per line if they're larger than 5 elements.
44
-module(inline_items_when_over).
55

6-
-format #{inline_items => {when_over, 5}, paper => 80}.
6+
-format #{paper => 80, inline_items => {when_over, 5}}.
77

88
-export([short_tuple/0, short_list/0, short_fun/0]).
99
-export([short_bin/0, short_guard/1, short_lc/0]).

test_app/after/src/inline_items/inline_items_when_under.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-module(inline_items_when_under).
22

3-
-format #{inline_items => {when_under, 5}, paper => 80}.
3+
-format #{paper => 80, inline_items => {when_under, 5}}.
44

55
-export([short_tuple/0, short_list/0, short_fun/0]).
66
-export([short_bin/0, short_guard/1, short_lc/0]).

test_app/after/src/inline_items/inline_no_items.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
%% per line if they're large.
44
-module(inline_no_items).
55

6-
-format #{inline_items => none, paper => 80}.
6+
-format #{paper => 80, inline_items => none}.
77

88
-export([short_tuple/0, short_list/0, short_fun/0]).
99
-export([short_bin/0, short_guard/1, short_lc/0]).

test_app/after/src/paper_and_ribbon/indent_18.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
-module(indent_18).
22

3-
-format #{break_indent => 1,
4-
inline_clause_bodies => true,
3+
-format #{sub_indent => 8,
4+
break_indent => 1,
55
paper => 50,
6-
sub_indent => 8}.
6+
inline_clause_bodies => true}.
77

88
-record(record,
99
{fields =

test_app/after/src/paper_and_ribbon/indent_81.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
-module(indent_81).
22

3-
-format #{break_indent => 8,
4-
paper => 50,
5-
sub_indent => 1}.
3+
-format #{sub_indent => 1,
4+
break_indent => 8,
5+
paper => 50}.
66
-format #{inline_clause_bodies => true}.
77

88
-record(record,

0 commit comments

Comments
 (0)