aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/folding_ranges.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/folding_ranges.rs')
-rw-r--r--crates/ra_ide_api/src/folding_ranges.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/folding_ranges.rs b/crates/ra_ide_api/src/folding_ranges.rs
index c2b981aed..9699000db 100644
--- a/crates/ra_ide_api/src/folding_ranges.rs
+++ b/crates/ra_ide_api/src/folding_ranges.rs
@@ -35,7 +35,7 @@ pub(crate) fn folding_ranges(file: &SourceFile) -> Vec<Fold> {
35 SyntaxElement::Token(token) => token.text().contains('\n'), 35 SyntaxElement::Token(token) => token.text().contains('\n'),
36 }; 36 };
37 if is_multiline { 37 if is_multiline {
38 res.push(Fold { range: element.range(), kind }); 38 res.push(Fold { range: element.text_range(), kind });
39 continue; 39 continue;
40 } 40 }
41 } 41 }
@@ -132,7 +132,7 @@ fn contiguous_range_for_group_unless(
132 } 132 }
133 133
134 if first != &last { 134 if first != &last {
135 Some(TextRange::from_to(first.range().start(), last.range().end())) 135 Some(TextRange::from_to(first.text_range().start(), last.text_range().end()))
136 } else { 136 } else {
137 // The group consists of only one element, therefore it cannot be folded 137 // The group consists of only one element, therefore it cannot be folded
138 None 138 None
@@ -178,7 +178,10 @@ fn contiguous_range_for_comment(
178 } 178 }
179 179
180 if first != last { 180 if first != last {
181 Some(TextRange::from_to(first.syntax().range().start(), last.syntax().range().end())) 181 Some(TextRange::from_to(
182 first.syntax().text_range().start(),
183 last.syntax().text_range().end(),
184 ))
182 } else { 185 } else {
183 // The group consists of only one element, therefore it cannot be folded 186 // The group consists of only one element, therefore it cannot be folded
184 None 187 None