Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

diagnostics: Update diagnostics more eagerly (#10560)

Piotr Osiewiczad22bddffa29
diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs
index e764a9e8ef0..11bac433fd4 100644
--- a/crates/diagnostics/src/diagnostics.rs
+++ b/crates/diagnostics/src/diagnostics.rs
@@ -136,8 +136,15 @@ impl ProjectDiagnosticsEditor {
.entry(*language_server_id)
.or_default()
.insert(path.clone());
- if this.editor.read(cx).selections.all::<usize>(cx).is_empty()
- && !this.is_dirty(cx)
+
+ if this.is_dirty(cx) {
+ return;
+ }
+ let selections = this.editor.read(cx).selections.all::<usize>(cx);
+ if selections.len() < 2
+ && selections
+ .first()
+ .map_or(true, |selection| selection.end == selection.start)
{
this.update_excerpts(Some(*language_server_id), cx);
}