Clip diagnostic range before and during empty range expansion

Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Julia 2022-11-23 13:20:47 -05:00
parent e51cbf67ab
commit b58ae8bdd7
3 changed files with 10 additions and 7 deletions

View file

@ -6,7 +6,7 @@ use std::{
ops::Range,
};
use sum_tree::{self, Bias, SumTree};
use text::{Anchor, FromAnchor, PointUtf16, ToOffset, Unclipped};
use text::{Anchor, FromAnchor, PointUtf16, ToOffset};
#[derive(Clone, Debug, Default)]
pub struct DiagnosticSet {
@ -63,7 +63,7 @@ impl DiagnosticSet {
pub fn new<I>(iter: I, buffer: &text::BufferSnapshot) -> Self
where
I: IntoIterator<Item = DiagnosticEntry<Unclipped<PointUtf16>>>,
I: IntoIterator<Item = DiagnosticEntry<PointUtf16>>,
{
let mut entries = iter.into_iter().collect::<Vec<_>>();
entries.sort_unstable_by_key(|entry| (entry.range.start, Reverse(entry.range.end)));