Skip to content

Commit 6476287

Browse files
committed
Fix support for multiline list patterns, Scony#46
1 parent c2f604a commit 6476287

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

gdtoolkit/formatter/expression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def _format_foldable_to_multiple_lines(
196196
"actual_getattr_call": _format_call_expression_to_multiple_lines,
197197
"actual_subscr_expr": _format_subscription_to_multiple_lines,
198198
# patterns (fake expressions):
199-
"list_pattern": _format_args_to_multiple_lines,
199+
"list_pattern": _format_concrete_expression_to_single_line,
200200
"test_pattern": _format_operator_chain_based_expression_to_multiple_lines,
201201
"par_pattern": _format_parentheses_to_multiple_lines,
202202
"or_pattern": _format_operator_chain_based_expression_to_multiple_lines,

tests/formatter/input-output-pairs/multiline_match_statements.in.gd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
class X:
22
func foo(x):
33
match x:
4-
# TODO:
5-
# 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1:
6-
# pass
4+
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1:
5+
pass
76
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" if true else "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb":
87
pass
98
true or false or true or false or true or false or true or false or true or false or true or false or true or false or true:

tests/formatter/input-output-pairs/multiline_match_statements.out.gd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
class X:
22
func foo(x):
33
match x:
4-
# TODO:
5-
# 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1:
6-
# pass
4+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1:
5+
pass
76
(
87
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
98
if true

0 commit comments

Comments
 (0)