Skip to content

Commit 71f44db

Browse files
committed
Fix incorrect indentation for match patterns using and or or
Close #328
1 parent 79d8236 commit 71f44db

4 files changed

Lines changed: 8 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ This file documents the changes made to the formatter with each release.
2525
- Fixed special get syntax with parentheses having an extra space (#314)
2626
- Output warnings to stderr when using reorder and safe mode together (#332)
2727
- Removed the space between `...` and variadic parameter names (#331)
28+
- Fixed incorrect indentation for match patterns using `and` or `or` (#328)
2829

2930
## Release 0.24.0 (2026-07-25)
3031

src/formatter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2295,6 +2295,7 @@ fn expression_is_in_single_indent_container(node: tree_sitter::Node) -> bool {
22952295
| GDScriptNodeKind::Arguments
22962296
| GDScriptNodeKind::SubscriptArguments
22972297
| GDScriptNodeKind::ParenthesizedExpression
2298+
| GDScriptNodeKind::MatchBody
22982299
) {
22992300
return true;
23002301
}

tests/expected/match_case.gd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@ func foo():
3030
animation.play("right")
3131
_:
3232
animation.play("right")
33+
match value:
34+
1 or 2:
35+
print("1 or 2")

tests/input/match_case.gd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ func foo():
2727
Type.LEFT: animation.play("left")
2828
Type.RIGHT: animation.play("right")
2929
_: animation.play("right")
30+
match value:
31+
1 or 2:
32+
print("1 or 2")

0 commit comments

Comments
 (0)