Allow retrieving a buffer's diagnostics
This commit is contained in:
parent
5bfbeb55c0
commit
ef4fc42d93
5 changed files with 140 additions and 35 deletions
|
@ -175,10 +175,10 @@ impl<T: Clone> Default for AnchorRangeMultimap<T> {
|
|||
}
|
||||
|
||||
impl<T: Clone> AnchorRangeMultimap<T> {
|
||||
fn intersecting_point_ranges<'a, O>(
|
||||
pub fn intersecting_point_ranges<'a, O>(
|
||||
&'a self,
|
||||
range: Range<O>,
|
||||
content: &'a Content<'a>,
|
||||
content: Content<'a>,
|
||||
inclusive: bool,
|
||||
) -> impl Iterator<Item = (usize, Range<Point>, &T)> + 'a
|
||||
where
|
||||
|
@ -187,10 +187,11 @@ impl<T: Clone> AnchorRangeMultimap<T> {
|
|||
use super::ToPoint as _;
|
||||
|
||||
let end_bias = if inclusive { Bias::Right } else { Bias::Left };
|
||||
let range = range.start.to_full_offset(content, Bias::Left)
|
||||
..range.end.to_full_offset(content, end_bias);
|
||||
let range = range.start.to_full_offset(&content, Bias::Left)
|
||||
..range.end.to_full_offset(&content, end_bias);
|
||||
let mut cursor = self.entries.filter::<_, usize>(
|
||||
{
|
||||
let content = content.clone();
|
||||
let mut endpoint = Anchor {
|
||||
full_offset: 0,
|
||||
bias: Bias::Right,
|
||||
|
@ -199,12 +200,12 @@ impl<T: Clone> AnchorRangeMultimap<T> {
|
|||
move |summary: &AnchorRangeMultimapSummary| {
|
||||
endpoint.full_offset = summary.max_end;
|
||||
endpoint.bias = self.end_bias;
|
||||
let max_end = endpoint.to_full_offset(content, self.end_bias);
|
||||
let max_end = endpoint.to_full_offset(&content, self.end_bias);
|
||||
let start_cmp = range.start.cmp(&max_end);
|
||||
|
||||
endpoint.full_offset = summary.min_start;
|
||||
endpoint.bias = self.start_bias;
|
||||
let min_start = endpoint.to_full_offset(content, self.start_bias);
|
||||
let min_start = endpoint.to_full_offset(&content, self.start_bias);
|
||||
let end_cmp = range.end.cmp(&min_start);
|
||||
|
||||
if inclusive {
|
||||
|
@ -228,10 +229,10 @@ impl<T: Clone> AnchorRangeMultimap<T> {
|
|||
let ix = *cursor.start();
|
||||
endpoint.full_offset = item.range.start;
|
||||
endpoint.bias = self.start_bias;
|
||||
let start = endpoint.to_point(content);
|
||||
let start = endpoint.to_point(&content);
|
||||
endpoint.full_offset = item.range.end;
|
||||
endpoint.bias = self.end_bias;
|
||||
let end = endpoint.to_point(content);
|
||||
let end = endpoint.to_point(&content);
|
||||
let value = &item.value;
|
||||
cursor.next(&());
|
||||
Some((ix, start..end, value))
|
||||
|
|
|
@ -1592,6 +1592,7 @@ impl Snapshot {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Content<'a> {
|
||||
visible_text: &'a Rope,
|
||||
deleted_text: &'a Rope,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue