Folding range for statics
This commit is contained in:
parent
391be07298
commit
a813062ed2
1 changed files with 7 additions and 0 deletions
|
|
@ -33,6 +33,7 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
|
|||
let mut visited_imports = FxHashSet::default();
|
||||
let mut visited_mods = FxHashSet::default();
|
||||
let mut visited_consts = FxHashSet::default();
|
||||
let mut visited_statics = FxHashSet::default();
|
||||
// regions can be nested, here is a LIFO buffer
|
||||
let mut regions_starts: Vec<TextSize> = vec![];
|
||||
|
||||
|
|
@ -101,6 +102,12 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
|
|||
res.push(Fold { range, kind: FoldKind::Consts })
|
||||
}
|
||||
}
|
||||
// Fold groups of consts
|
||||
if node.kind() == STATIC && !visited_statics.contains(&node) {
|
||||
if let Some(range) = contiguous_range_for_group(&node, &mut visited_statics) {
|
||||
res.push(Fold { range, kind: FoldKind::Statics })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue