[ty] Don't create a related diagnostic for the primary annotation of sub-diagnostics (#21845)

This commit is contained in:
Micha Reiser 2025-12-08 15:22:11 +01:00 committed by GitHub
parent b845e81c4a
commit 4364ffbdd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View File

@ -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.

View File

@ -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)
}),