diff options
Diffstat (limited to 'crates/ide')
-rw-r--r-- | crates/ide/src/folding_ranges.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ide/src/folding_ranges.rs b/crates/ide/src/folding_ranges.rs index 1dd37483f..8f3144de0 100644 --- a/crates/ide/src/folding_ranges.rs +++ b/crates/ide/src/folding_ranges.rs | |||
@@ -32,6 +32,7 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> { | |||
32 | let mut visited_comments = FxHashSet::default(); | 32 | let mut visited_comments = FxHashSet::default(); |
33 | let mut visited_imports = FxHashSet::default(); | 33 | let mut visited_imports = FxHashSet::default(); |
34 | let mut visited_mods = FxHashSet::default(); | 34 | let mut visited_mods = FxHashSet::default(); |
35 | let mut visited_consts = FxHashSet::default(); | ||
35 | // regions can be nested, here is a LIFO buffer | 36 | // regions can be nested, here is a LIFO buffer |
36 | let mut regions_starts: Vec<TextSize> = vec![]; | 37 | let mut regions_starts: Vec<TextSize> = vec![]; |
37 | 38 | ||
@@ -93,6 +94,13 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> { | |||
93 | res.push(Fold { range, kind: FoldKind::Mods }) | 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 | } |