aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src')
-rwxr-xr-x[-rw-r--r--]crates/ide/src/folding_ranges.rs14
1 files changed, 3 insertions, 11 deletions
diff --git a/crates/ide/src/folding_ranges.rs b/crates/ide/src/folding_ranges.rs
index e03ddaa14..a03988778 100644..100755
--- a/crates/ide/src/folding_ranges.rs
+++ b/crates/ide/src/folding_ranges.rs
@@ -36,7 +36,6 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
36 let mut visited_mods = FxHashSet::default(); 36 let mut visited_mods = FxHashSet::default();
37 let mut visited_consts = FxHashSet::default(); 37 let mut visited_consts = FxHashSet::default();
38 let mut visited_statics = FxHashSet::default(); 38 let mut visited_statics = FxHashSet::default();
39 let mut visited_where_clauses = FxHashSet::default();
40 // regions can be nested, here is a LIFO buffer 39 // regions can be nested, here is a LIFO buffer
41 let mut regions_starts: Vec<TextSize> = vec![]; 40 let mut regions_starts: Vec<TextSize> = vec![];
42 41
@@ -113,10 +112,8 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
113 } 112 }
114 113
115 // Fold where clause 114 // Fold where clause
116 if node.kind() == WHERE_CLAUSE && !visited_where_clauses.contains(&node) { 115 if node.kind() == WHERE_CLAUSE {
117 if let Some(range) = 116 if let Some(range) = fold_range_for_where_clause(&node) {
118 contiguous_range_for_where(&node, &mut visited_where_clauses)
119 {
120 res.push(Fold { range, kind: FoldKind::WhereClause }) 117 res.push(Fold { range, kind: FoldKind::WhereClause })
121 } 118 }
122 } 119 }
@@ -252,10 +249,7 @@ fn contiguous_range_for_comment(
252 } 249 }
253} 250}
254 251
255fn contiguous_range_for_where( 252fn fold_range_for_where_clause(node: &SyntaxNode) -> Option<TextRange> {
256 node: &SyntaxNode,
257 visited: &mut FxHashSet<SyntaxNode>,
258) -> Option<TextRange> {
259 let first_where_pred = node.first_child(); 253 let first_where_pred = node.first_child();
260 let last_where_pred = node.last_child(); 254 let last_where_pred = node.last_child();
261 255
@@ -266,8 +260,6 @@ fn contiguous_range_for_where(
266 { 260 {
267 let start = where_kw.text_range().end(); 261 let start = where_kw.text_range().end();
268 let end = last_comma.text_range().end(); 262 let end = last_comma.text_range().end();
269
270 visited.insert(node.clone());
271 return Some(TextRange::new(start, end)); 263 return Some(TextRange::new(start, end));
272 } 264 }
273 } 265 }