Remove duplication when assigning diagnostics and hardcode provider names

This commit is contained in:
Antonio Scandurra 2021-12-24 12:07:26 +01:00
parent 4f774e2bde
commit 11e3874b4a
8 changed files with 198 additions and 178 deletions

View file

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