diff options
author | Ayomide Bamidele <[email protected]> | 2021-03-29 12:20:26 +0100 |
---|---|---|
committer | Ayomide Bamidele <[email protected]> | 2021-03-29 12:20:26 +0100 |
commit | a813062ed206b4382a1694ea6aef019f18733bca (patch) | |
tree | 925491fe07244d6702bcbe599aba0d9c224154ae | |
parent | 391be072987bfccf2985a9d09623bbb73d60e3ff (diff) |
Folding range for statics
-rw-r--r-- | crates/ide/src/folding_ranges.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/ide/src/folding_ranges.rs b/crates/ide/src/folding_ranges.rs index 8f3144de0..8b8a2cc38 100644 --- a/crates/ide/src/folding_ranges.rs +++ b/crates/ide/src/folding_ranges.rs | |||
@@ -33,6 +33,7 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> { | |||
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 | let mut visited_consts = FxHashSet::default(); |
36 | let mut visited_statics = FxHashSet::default(); | ||
36 | // regions can be nested, here is a LIFO buffer | 37 | // regions can be nested, here is a LIFO buffer |
37 | let mut regions_starts: Vec<TextSize> = vec![]; | 38 | let mut regions_starts: Vec<TextSize> = vec![]; |
38 | 39 | ||
@@ -101,6 +102,12 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> { | |||
101 | res.push(Fold { range, kind: FoldKind::Consts }) | 102 | res.push(Fold { range, kind: FoldKind::Consts }) |
102 | } | 103 | } |
103 | } | 104 | } |
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 | } | ||
104 | } | 111 | } |
105 | } | 112 | } |
106 | } | 113 | } |