aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/syntax_highlighting.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting.rs')
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index c0728bfb1..6f02614a6 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -61,16 +61,16 @@ impl HighlightedRangeStack {
61 let prev = self.stack.last_mut().unwrap(); 61 let prev = self.stack.last_mut().unwrap();
62 let needs_flattening = !children.is_empty() 62 let needs_flattening = !children.is_empty()
63 && !prev.is_empty() 63 && !prev.is_empty()
64 && children.first().unwrap().range.is_subrange(&prev.last().unwrap().range); 64 && prev.last().unwrap().range.contains_range(children.first().unwrap().range);
65 if !needs_flattening { 65 if !needs_flattening {
66 prev.extend(children); 66 prev.extend(children);
67 } else { 67 } else {
68 let mut parent = prev.pop().unwrap(); 68 let mut parent = prev.pop().unwrap();
69 for ele in children { 69 for ele in children {
70 assert!(ele.range.is_subrange(&parent.range)); 70 assert!(parent.range.contains_range(ele.range));
71 let mut cloned = parent.clone(); 71 let mut cloned = parent.clone();
72 parent.range = TextRange::from_to(parent.range.start(), ele.range.start()); 72 parent.range = TextRange::new(parent.range.start(), ele.range.start());
73 cloned.range = TextRange::from_to(ele.range.end(), cloned.range.end()); 73 cloned.range = TextRange::new(ele.range.end(), cloned.range.end());
74 if !parent.range.is_empty() { 74 if !parent.range.is_empty() {
75 prev.push(parent); 75 prev.push(parent);
76 } 76 }
@@ -152,7 +152,7 @@ pub(crate) fn highlight(
152 }; 152 };
153 153
154 // Element outside of the viewport, no need to highlight 154 // Element outside of the viewport, no need to highlight
155 if range_to_highlight.intersection(&event_range).is_none() { 155 if range_to_highlight.intersect(event_range).is_none() {
156 continue; 156 continue;
157 } 157 }
158 158
@@ -309,7 +309,7 @@ fn macro_call_range(macro_call: &ast::MacroCall) -> Option<TextRange> {
309 } 309 }
310 } 310 }
311 311
312 Some(TextRange::from_to(range_start, range_end)) 312 Some(TextRange::new(range_start, range_end))
313} 313}
314 314
315fn highlight_element( 315fn highlight_element(