File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ pub enum FoldKind {
1919 Region ,
2020 Consts ,
2121 Statics ,
22+ Array ,
2223}
2324
2425#[ derive( Debug ) ]
@@ -119,6 +120,7 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
119120 match kind {
120121 COMMENT => Some ( FoldKind :: Comment ) ,
121122 ARG_LIST | PARAM_LIST => Some ( FoldKind :: ArgList ) ,
123+ ARRAY_EXPR => Some ( FoldKind :: Array ) ,
122124 ASSOC_ITEM_LIST
123125 | RECORD_FIELD_LIST
124126 | RECORD_PAT_FIELD_LIST
@@ -269,6 +271,7 @@ mod tests {
269271 FoldKind :: Region => "region" ,
270272 FoldKind :: Consts => "consts" ,
271273 FoldKind :: Statics => "statics" ,
274+ FoldKind :: Array => "array" ,
272275 } ;
273276 assert_eq ! ( kind, & attr. unwrap( ) ) ;
274277 }
@@ -464,6 +467,20 @@ fn foo<fold arglist>(
464467 )
465468 }
466469
470+ #[ test]
471+ fn fold_multiline_array ( ) {
472+ check (
473+ r#"
474+ const FOO: [usize; 4] = <fold array>[
475+ 1,
476+ 2,
477+ 3,
478+ 4,
479+ ]</fold>;
480+ "# ,
481+ )
482+ }
483+
467484 #[ test]
468485 fn fold_region ( ) {
469486 check (
Original file line number Diff line number Diff line change @@ -497,7 +497,8 @@ pub(crate) fn folding_range(
497497 | FoldKind :: Block
498498 | FoldKind :: ArgList
499499 | FoldKind :: Consts
500- | FoldKind :: Statics => None ,
500+ | FoldKind :: Statics
501+ | FoldKind :: Array => None ,
501502 } ;
502503
503504 let range = range ( line_index, fold. range ) ;
You can’t perform that action at this time.
0 commit comments