Skip to content

Commit 44bab36

Browse files
bors[bot]Centril
andauthored
Merge #1873
1873: `fold_kind`: `MATCH_ARM_LIST => FoldKind::Block` r=matklad a=Centril As suggested by @matklad in https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/folding.20of.20.60match.60.20and.20.60if.60/near/176109093. This should let folks fold all the arms in a `match` expression rather than just each arm individually. Co-authored-by: Mazdak Farrokhzad <[email protected]>
2 parents 4eb0bb4 + 2be9031 commit 44bab36

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

crates/ra_ide_api/src/folding_ranges.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
8787
| EXTERN_ITEM_LIST
8888
| USE_TREE_LIST
8989
| BLOCK
90+
| MATCH_ARM_LIST
9091
| ENUM_VARIANT_LIST
9192
| TOKEN_TREE => Some(FoldKind::Block),
9293
_ => None,
@@ -358,4 +359,18 @@ macro_rules! foo <fold>{
358359
let folds = &[FoldKind::Block];
359360
do_check(text, folds);
360361
}
362+
363+
#[test]
364+
fn test_fold_match_arms() {
365+
let text = r#"
366+
fn main() <fold>{
367+
match 0 <fold>{
368+
0 => 0,
369+
_ => 1,
370+
}</fold>
371+
}</fold>"#;
372+
373+
let folds = &[FoldKind::Block, FoldKind::Block];
374+
do_check(text, folds);
375+
}
361376
}

0 commit comments

Comments
 (0)