From 1f97445f39bc1fec4c6b38eb1a801da6871698b2 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 19 Sep 2019 17:22:08 +0200 Subject: `fold_kind`: `MATCH_ARM_LIST => FoldKind::Block` --- crates/ra_ide_api/src/folding_ranges.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 { | EXTERN_ITEM_LIST | USE_TREE_LIST | BLOCK + | MATCH_ARM_LIST | ENUM_VARIANT_LIST | TOKEN_TREE => Some(FoldKind::Block), _ => None, @@ -358,4 +359,21 @@ macro_rules! foo { let folds = &[FoldKind::Block]; do_check(text, folds); } + + #[test] + fn test_fold_match_arms() { + let text = r#" +fn main() { + match 0 { + 0 => 0, + _ => 1, + } +}"#; + + let folds = &[ + FoldKind::Block, + FoldKind::Block, + ]; + do_check(text, folds); + } } -- cgit v1.2.3 From 2be9031935c92c4837c2d16e7dd503658108524b Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 19 Sep 2019 17:37:41 +0200 Subject: Pacify rustfmt. --- crates/ra_ide_api/src/folding_ranges.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/ra_ide_api/src/folding_ranges.rs b/crates/ra_ide_api/src/folding_ranges.rs index fc18222f2..79fadcc5d 100644 --- a/crates/ra_ide_api/src/folding_ranges.rs +++ b/crates/ra_ide_api/src/folding_ranges.rs @@ -370,10 +370,7 @@ fn main() { } }"#; - let folds = &[ - FoldKind::Block, - FoldKind::Block, - ]; + let folds = &[FoldKind::Block, FoldKind::Block]; do_check(text, folds); } } -- cgit v1.2.3