diff options
Diffstat (limited to 'crates/ra_editor/src/folding_ranges.rs')
-rw-r--r-- | crates/ra_editor/src/folding_ranges.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_editor/src/folding_ranges.rs b/crates/ra_editor/src/folding_ranges.rs index 817da28d1..892aaf97b 100644 --- a/crates/ra_editor/src/folding_ranges.rs +++ b/crates/ra_editor/src/folding_ranges.rs | |||
@@ -3,7 +3,7 @@ use std::collections::HashSet; | |||
3 | use ra_syntax::{ | 3 | use ra_syntax::{ |
4 | File, TextRange, SyntaxNodeRef, | 4 | File, TextRange, SyntaxNodeRef, |
5 | SyntaxKind, | 5 | SyntaxKind, |
6 | algo::{walk, Direction, siblings}, | 6 | algo::{Direction, siblings}, |
7 | }; | 7 | }; |
8 | 8 | ||
9 | #[derive(Debug, PartialEq, Eq)] | 9 | #[derive(Debug, PartialEq, Eq)] |
@@ -19,12 +19,10 @@ pub struct Fold { | |||
19 | } | 19 | } |
20 | 20 | ||
21 | pub fn folding_ranges(file: &File) -> Vec<Fold> { | 21 | pub fn folding_ranges(file: &File) -> Vec<Fold> { |
22 | let syntax = file.syntax(); | ||
23 | |||
24 | let mut res = vec![]; | 22 | let mut res = vec![]; |
25 | let mut visited = HashSet::new(); | 23 | let mut visited = HashSet::new(); |
26 | 24 | ||
27 | for node in walk::preorder(syntax) { | 25 | for node in file.syntax().descendants() { |
28 | if visited.contains(&node) { | 26 | if visited.contains(&node) { |
29 | continue; | 27 | continue; |
30 | } | 28 | } |
@@ -139,4 +137,4 @@ fn main() { | |||
139 | } | 137 | } |
140 | 138 | ||
141 | 139 | ||
142 | } \ No newline at end of file | 140 | } |