aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/syntax_highlighting/highlights.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-01-13 17:10:46 +0000
committerAleksey Kladov <[email protected]>2021-01-13 18:32:24 +0000
commit3d78f502bdb74a2d0b9cc8d9bb990e0a471dfb8c (patch)
tree652c20b44230439351678936db4b5c590bbd177b /crates/ide/src/syntax_highlighting/highlights.rs
parentf84f5cb0ea3c1b10fbe96038d0201975913425cc (diff)
Use upstream TextSize API
Diffstat (limited to 'crates/ide/src/syntax_highlighting/highlights.rs')
-rw-r--r--crates/ide/src/syntax_highlighting/highlights.rs14
1 files changed, 2 insertions, 12 deletions
diff --git a/crates/ide/src/syntax_highlighting/highlights.rs b/crates/ide/src/syntax_highlighting/highlights.rs
index c6f0417ec..882a685a5 100644
--- a/crates/ide/src/syntax_highlighting/highlights.rs
+++ b/crates/ide/src/syntax_highlighting/highlights.rs
@@ -1,5 +1,5 @@
1//! Collects a tree of highlighted ranges and flattens it. 1//! Collects a tree of highlighted ranges and flattens it.
2use std::{cmp::Ordering, iter}; 2use std::iter;
3 3
4use stdx::equal_range_by; 4use stdx::equal_range_by;
5use syntax::TextRange; 5use syntax::TextRange;
@@ -52,7 +52,7 @@ impl Node {
52 } 52 }
53 53
54 let overlapping = 54 let overlapping =
55 equal_range_by(&self.nested, |n| ordering(n.hl_range.range, hl_range.range)); 55 equal_range_by(&self.nested, |n| TextRange::ordering(n.hl_range.range, hl_range.range));
56 56
57 if overlapping.len() == 1 57 if overlapping.len() == 1
58 && self.nested[overlapping.start].hl_range.range.contains_range(hl_range.range) 58 && self.nested[overlapping.start].hl_range.range.contains_range(hl_range.range)
@@ -90,13 +90,3 @@ impl Node {
90 } 90 }
91 } 91 }
92} 92}
93
94pub(super) fn ordering(r1: TextRange, r2: TextRange) -> Ordering {
95 if r1.end() <= r2.start() {
96 Ordering::Less
97 } else if r2.end() <= r1.start() {
98 Ordering::Greater
99 } else {
100 Ordering::Equal
101 }
102}