File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
32
32
let mut visited_comments = FxHashSet :: default ( ) ;
33
33
let mut visited_imports = FxHashSet :: default ( ) ;
34
34
let mut visited_mods = FxHashSet :: default ( ) ;
35
+ let mut visited_consts = FxHashSet :: default ( ) ;
35
36
// regions can be nested, here is a LIFO buffer
36
37
let mut regions_starts: Vec < TextSize > = vec ! [ ] ;
37
38
@@ -93,6 +94,13 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
93
94
res. push ( Fold { range, kind : FoldKind :: Mods } )
94
95
}
95
96
}
97
+
98
+ // Fold groups of consts
99
+ if node. kind ( ) == CONST && !visited_consts. contains ( & node) {
100
+ if let Some ( range) = contiguous_range_for_group ( & node, & mut visited_consts) {
101
+ res. push ( Fold { range, kind : FoldKind :: Consts } )
102
+ }
103
+ }
96
104
}
97
105
}
98
106
}
Original file line number Diff line number Diff line change @@ -492,7 +492,7 @@ pub(crate) fn folding_range(
492
492
FoldKind :: Comment => Some ( lsp_types:: FoldingRangeKind :: Comment ) ,
493
493
FoldKind :: Imports => Some ( lsp_types:: FoldingRangeKind :: Imports ) ,
494
494
FoldKind :: Region => Some ( lsp_types:: FoldingRangeKind :: Region ) ,
495
- FoldKind :: Mods | FoldKind :: Block | FoldKind :: ArgList => None ,
495
+ FoldKind :: Mods | FoldKind :: Block | FoldKind :: ArgList | FoldKind :: Consts | FoldKind :: Statics => None ,
496
496
} ;
497
497
498
498
let range = range ( line_index, fold. range ) ;
You can’t perform that action at this time.
0 commit comments