aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/folding_ranges.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/folding_ranges.rs')
-rw-r--r--crates/ra_ide/src/folding_ranges.rs24
1 files changed, 18 insertions, 6 deletions
diff --git a/crates/ra_ide/src/folding_ranges.rs b/crates/ra_ide/src/folding_ranges.rs
index e7ec9953f..5a6e17936 100644
--- a/crates/ra_ide/src/folding_ranges.rs
+++ b/crates/ra_ide/src/folding_ranges.rs
@@ -58,7 +58,7 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
58 } 58 }
59 NodeOrToken::Node(node) => { 59 NodeOrToken::Node(node) => {
60 // Fold groups of imports 60 // Fold groups of imports
61 if node.kind() == USE_ITEM && !visited_imports.contains(&node) { 61 if node.kind() == USE && !visited_imports.contains(&node) {
62 if let Some(range) = contiguous_range_for_group(&node, &mut visited_imports) { 62 if let Some(range) = contiguous_range_for_group(&node, &mut visited_imports) {
63 res.push(Fold { range, kind: FoldKind::Imports }) 63 res.push(Fold { range, kind: FoldKind::Imports })
64 } 64 }
@@ -83,17 +83,17 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
83fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> { 83fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
84 match kind { 84 match kind {
85 COMMENT => Some(FoldKind::Comment), 85 COMMENT => Some(FoldKind::Comment),
86 USE_ITEM => Some(FoldKind::Imports), 86 USE => Some(FoldKind::Imports),
87 ARG_LIST => Some(FoldKind::ArgList), 87 ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList),
88 RECORD_FIELD_DEF_LIST 88 RECORD_FIELD_LIST
89 | RECORD_FIELD_PAT_LIST 89 | RECORD_FIELD_PAT_LIST
90 | RECORD_FIELD_LIST 90 | RECORD_EXPR_FIELD_LIST
91 | ITEM_LIST 91 | ITEM_LIST
92 | EXTERN_ITEM_LIST 92 | EXTERN_ITEM_LIST
93 | USE_TREE_LIST 93 | USE_TREE_LIST
94 | BLOCK_EXPR 94 | BLOCK_EXPR
95 | MATCH_ARM_LIST 95 | MATCH_ARM_LIST
96 | ENUM_VARIANT_LIST 96 | VARIANT_LIST
97 | TOKEN_TREE => Some(FoldKind::Block), 97 | TOKEN_TREE => Some(FoldKind::Block),
98 _ => None, 98 _ => None,
99 } 99 }
@@ -386,4 +386,16 @@ const _: S = S <fold block>{
386"#, 386"#,
387 ) 387 )
388 } 388 }
389
390 #[test]
391 fn fold_multiline_params() {
392 check(
393 r#"
394fn foo<fold arglist>(
395 x: i32,
396 y: String,
397)</fold> {}
398"#,
399 )
400 }
389} 401}