Rip out "diagnostic providers"
This commit is contained in:
@@ -2857,19 +2857,19 @@ impl Editor {
|
||||
loop {
|
||||
let next_group = buffer
|
||||
.diagnostics_in_range::<_, usize>(search_start..buffer.len())
|
||||
.find_map(|(provider_name, entry)| {
|
||||
.find_map(|entry| {
|
||||
if entry.diagnostic.is_primary
|
||||
&& !entry.range.is_empty()
|
||||
&& Some(entry.range.end) != active_primary_range.as_ref().map(|r| *r.end())
|
||||
{
|
||||
Some((provider_name, entry.range, entry.diagnostic.group_id))
|
||||
Some((entry.range, entry.diagnostic.group_id))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
});
|
||||
|
||||
if let Some((provider_name, primary_range, group_id)) = next_group {
|
||||
self.activate_diagnostics(provider_name, group_id, cx);
|
||||
if let Some((primary_range, group_id)) = next_group {
|
||||
self.activate_diagnostics(group_id, cx);
|
||||
self.update_selections(
|
||||
vec![Selection {
|
||||
id: selection.id,
|
||||
@@ -2897,7 +2897,7 @@ impl Editor {
|
||||
let primary_range_start = active_diagnostics.primary_range.start.to_offset(&buffer);
|
||||
let is_valid = buffer
|
||||
.diagnostics_in_range::<_, usize>(active_diagnostics.primary_range.clone())
|
||||
.any(|(_, entry)| {
|
||||
.any(|entry| {
|
||||
entry.diagnostic.is_primary
|
||||
&& !entry.range.is_empty()
|
||||
&& entry.range.start == primary_range_start
|
||||
@@ -2923,12 +2923,7 @@ impl Editor {
|
||||
}
|
||||
}
|
||||
|
||||
fn activate_diagnostics(
|
||||
&mut self,
|
||||
provider_name: &str,
|
||||
group_id: usize,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) {
|
||||
fn activate_diagnostics(&mut self, group_id: usize, cx: &mut ViewContext<Self>) {
|
||||
self.dismiss_diagnostics(cx);
|
||||
self.active_diagnostics = self.display_map.update(cx, |display_map, cx| {
|
||||
let buffer = self.buffer.read(cx).snapshot(cx);
|
||||
@@ -2937,7 +2932,7 @@ impl Editor {
|
||||
let mut primary_message = None;
|
||||
let mut group_end = Point::zero();
|
||||
let diagnostic_group = buffer
|
||||
.diagnostic_group::<Point>(provider_name, group_id)
|
||||
.diagnostic_group::<Point>(group_id)
|
||||
.map(|entry| {
|
||||
if entry.range.end > group_end {
|
||||
group_end = entry.range.end;
|
||||
|
||||
@@ -298,9 +298,9 @@ impl DiagnosticMessage {
|
||||
let new_diagnostic = buffer
|
||||
.read(cx)
|
||||
.diagnostics_in_range::<_, usize>(cursor_position..cursor_position)
|
||||
.filter(|(_, entry)| !entry.range.is_empty())
|
||||
.min_by_key(|(_, entry)| (entry.diagnostic.severity, entry.range.len()))
|
||||
.map(|(_, entry)| entry.diagnostic);
|
||||
.filter(|entry| !entry.range.is_empty())
|
||||
.min_by_key(|entry| (entry.diagnostic.severity, entry.range.len()))
|
||||
.map(|entry| entry.diagnostic);
|
||||
if new_diagnostic != self.diagnostic {
|
||||
self.diagnostic = new_diagnostic;
|
||||
cx.notify();
|
||||
|
||||
@@ -1487,7 +1487,6 @@ impl MultiBufferSnapshot {
|
||||
|
||||
pub fn diagnostic_group<'a, O>(
|
||||
&'a self,
|
||||
provider_name: &'a str,
|
||||
group_id: usize,
|
||||
) -> impl Iterator<Item = DiagnosticEntry<O>> + 'a
|
||||
where
|
||||
@@ -1495,13 +1494,13 @@ impl MultiBufferSnapshot {
|
||||
{
|
||||
self.as_singleton()
|
||||
.into_iter()
|
||||
.flat_map(move |buffer| buffer.diagnostic_group(provider_name, group_id))
|
||||
.flat_map(move |buffer| buffer.diagnostic_group(group_id))
|
||||
}
|
||||
|
||||
pub fn diagnostics_in_range<'a, T, O>(
|
||||
&'a self,
|
||||
range: Range<T>,
|
||||
) -> impl Iterator<Item = (&'a str, DiagnosticEntry<O>)> + 'a
|
||||
) -> impl Iterator<Item = DiagnosticEntry<O>> + 'a
|
||||
where
|
||||
T: 'a + ToOffset,
|
||||
O: 'a + text::FromAnchor,
|
||||
|
||||
Reference in New Issue
Block a user