aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
authorMazdak Farrokhzad <[email protected]>2019-09-19 16:22:08 +0100
committerGitHub <[email protected]>2019-09-19 16:22:08 +0100
commit1f97445f39bc1fec4c6b38eb1a801da6871698b2 (patch)
tree72ab10d1673c410aedc0ff51839329c4280548fb /crates/ra_ide_api/src
parenteeac224c3543ce4c869877fe46ea8815286f97d2 (diff)
`fold_kind`: `MATCH_ARM_LIST => FoldKind::Block`
Diffstat (limited to 'crates/ra_ide_api/src')
-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}