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 {
19
19
Region ,
20
20
Consts ,
21
21
Statics ,
22
+ Array ,
22
23
}
23
24
24
25
#[ derive( Debug ) ]
@@ -119,6 +120,7 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
119
120
match kind {
120
121
COMMENT => Some ( FoldKind :: Comment ) ,
121
122
ARG_LIST | PARAM_LIST => Some ( FoldKind :: ArgList ) ,
123
+ ARRAY_EXPR => Some ( FoldKind :: Array ) ,
122
124
ASSOC_ITEM_LIST
123
125
| RECORD_FIELD_LIST
124
126
| RECORD_PAT_FIELD_LIST
@@ -269,6 +271,7 @@ mod tests {
269
271
FoldKind :: Region => "region" ,
270
272
FoldKind :: Consts => "consts" ,
271
273
FoldKind :: Statics => "statics" ,
274
+ FoldKind :: Array => "array" ,
272
275
} ;
273
276
assert_eq ! ( kind, & attr. unwrap( ) ) ;
274
277
}
@@ -464,6 +467,20 @@ fn foo<fold arglist>(
464
467
)
465
468
}
466
469
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
+
467
484
#[ test]
468
485
fn fold_region ( ) {
469
486
check (
Original file line number Diff line number Diff line change @@ -497,7 +497,8 @@ pub(crate) fn folding_range(
497
497
| FoldKind :: Block
498
498
| FoldKind :: ArgList
499
499
| FoldKind :: Consts
500
- | FoldKind :: Statics => None ,
500
+ | FoldKind :: Statics
501
+ | FoldKind :: Array => None ,
501
502
} ;
502
503
503
504
let range = range ( line_index, fold. range ) ;
You can’t perform that action at this time.
0 commit comments