Skip to content

Commit a813062

Browse files
committed
Folding range for statics
1 parent 391be07 commit a813062

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/ide/src/folding_ranges.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
3333
let mut visited_imports = FxHashSet::default();
3434
let mut visited_mods = FxHashSet::default();
3535
let mut visited_consts = FxHashSet::default();
36+
let mut visited_statics = FxHashSet::default();
3637
// regions can be nested, here is a LIFO buffer
3738
let mut regions_starts: Vec<TextSize> = vec![];
3839

@@ -101,6 +102,12 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
101102
res.push(Fold { range, kind: FoldKind::Consts })
102103
}
103104
}
105+
// Fold groups of consts
106+
if node.kind() == STATIC && !visited_statics.contains(&node) {
107+
if let Some(range) = contiguous_range_for_group(&node, &mut visited_statics) {
108+
res.push(Fold { range, kind: FoldKind::Statics })
109+
}
110+
}
104111
}
105112
}
106113
}

0 commit comments

Comments
 (0)