Ignore diagnostics with empty ranges
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
a023950f28
commit
b0afc80678
2 changed files with 2 additions and 0 deletions
|
@ -2242,6 +2242,7 @@ impl Editor {
|
||||||
.diagnostics_in_range::<_, usize>(search_start..buffer.len())
|
.diagnostics_in_range::<_, usize>(search_start..buffer.len())
|
||||||
.find_map(|(range, diagnostic)| {
|
.find_map(|(range, diagnostic)| {
|
||||||
if diagnostic.is_primary
|
if diagnostic.is_primary
|
||||||
|
&& !range.is_empty()
|
||||||
&& Some(range.end) != active_primary_range.as_ref().map(|r| *r.end())
|
&& Some(range.end) != active_primary_range.as_ref().map(|r| *r.end())
|
||||||
{
|
{
|
||||||
Some((range, diagnostic.group_id))
|
Some((range, diagnostic.group_id))
|
||||||
|
|
|
@ -263,6 +263,7 @@ impl DiagnosticMessage {
|
||||||
.buffer()
|
.buffer()
|
||||||
.read(cx)
|
.read(cx)
|
||||||
.diagnostics_in_range::<usize, usize>(cursor_position..cursor_position)
|
.diagnostics_in_range::<usize, usize>(cursor_position..cursor_position)
|
||||||
|
.filter(|(range, _)| !range.is_empty())
|
||||||
.min_by_key(|(range, diagnostic)| (diagnostic.severity, range.len()))
|
.min_by_key(|(range, diagnostic)| (diagnostic.severity, range.len()))
|
||||||
.map(|(_, diagnostic)| diagnostic.clone());
|
.map(|(_, diagnostic)| diagnostic.clone());
|
||||||
if new_diagnostic != self.diagnostic {
|
if new_diagnostic != self.diagnostic {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue