aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r--crates/ra_ide_api/src/folding_ranges.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/folding_ranges.rs b/crates/ra_ide_api/src/folding_ranges.rs
index 3ab6c195e..fc18222f2 100644
--- a/crates/ra_ide_api/src/folding_ranges.rs
+++ b/crates/ra_ide_api/src/folding_ranges.rs
@@ -87,6 +87,7 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
87 | EXTERN_ITEM_LIST 87 | EXTERN_ITEM_LIST
88 | USE_TREE_LIST 88 | USE_TREE_LIST
89 | BLOCK 89 | BLOCK
90 | MATCH_ARM_LIST
90 | ENUM_VARIANT_LIST 91 | ENUM_VARIANT_LIST
91 | TOKEN_TREE => Some(FoldKind::Block), 92 | TOKEN_TREE => Some(FoldKind::Block),
92 _ => None, 93 _ => None,
@@ -358,4 +359,21 @@ macro_rules! foo <fold>{
358 let folds = &[FoldKind::Block]; 359 let folds = &[FoldKind::Block];
359 do_check(text, folds); 360 do_check(text, folds);
360 } 361 }
362
363 #[test]
364 fn test_fold_match_arms() {
365 let text = r#"
366fn main() <fold>{
367 match 0 <fold>{
368 0 => 0,
369 _ => 1,
370 }</fold>
371}</fold>"#;
372
373 let folds = &[
374 FoldKind::Block,
375 FoldKind::Block,
376 ];
377 do_check(text, folds);
378 }
361} 379}