diff --git a/crates/ruff_db/src/diagnostic/mod.rs b/crates/ruff_db/src/diagnostic/mod.rs index 33348ddf2e..cf1114b11f 100644 --- a/crates/ruff_db/src/diagnostic/mod.rs +++ b/crates/ruff_db/src/diagnostic/mod.rs @@ -888,6 +888,10 @@ impl Annotation { pub fn hide_snippet(&mut self, yes: bool) { self.hide_snippet = yes; } + + pub fn is_primary(&self) -> bool { + self.is_primary + } } /// Tags that can be associated with an annotation. diff --git a/crates/ty_server/src/server/api/diagnostics.rs b/crates/ty_server/src/server/api/diagnostics.rs index d25e6f5243..3344738cbf 100644 --- a/crates/ty_server/src/server/api/diagnostics.rs +++ b/crates/ty_server/src/server/api/diagnostics.rs @@ -349,6 +349,7 @@ pub(super) fn to_lsp_diagnostic( sub_diagnostic .annotations() .iter() + .filter(|annotation| !annotation.is_primary()) .filter_map(|annotation| { annotation_to_related_information(db, annotation, encoding) }),