diff options
-rw-r--r-- | crates/rust-analyzer/src/diagnostics.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/rust-analyzer/src/diagnostics.rs b/crates/rust-analyzer/src/diagnostics.rs index ee6f2a867..f01548c50 100644 --- a/crates/rust-analyzer/src/diagnostics.rs +++ b/crates/rust-analyzer/src/diagnostics.rs | |||
@@ -65,6 +65,17 @@ impl DiagnosticCollection { | |||
65 | file_id: FileId, | 65 | file_id: FileId, |
66 | diagnostics: Vec<lsp_types::Diagnostic>, | 66 | diagnostics: Vec<lsp_types::Diagnostic>, |
67 | ) { | 67 | ) { |
68 | if let Some(existing_diagnostics) = self.native.get(&file_id) { | ||
69 | if existing_diagnostics.len() == diagnostics.len() | ||
70 | && diagnostics | ||
71 | .iter() | ||
72 | .zip(existing_diagnostics) | ||
73 | .all(|(new, existing)| are_diagnostics_equal(new, existing)) | ||
74 | { | ||
75 | return; | ||
76 | } | ||
77 | } | ||
78 | |||
68 | self.native.insert(file_id, diagnostics); | 79 | self.native.insert(file_id, diagnostics); |
69 | self.changes.insert(file_id); | 80 | self.changes.insert(file_id); |
70 | } | 81 | } |