add notable_trait predicate to CompletionRelevance

implement the predicate set on the case function from traits
This commit is contained in:
dfireBird 2024-01-06 15:48:10 +05:30
parent af40101841
commit df5c647982
No known key found for this signature in database
GPG key ID: 26D522CA5FC2B93D
5 changed files with 28 additions and 0 deletions

View file

@ -529,6 +529,11 @@ impl CompletionContext<'_> {
}
}
/// Whether the given trait has `#[doc(notable_trait)]`
pub(crate) fn is_doc_notable_trait(&self, trait_: hir::Trait) -> bool {
trait_.attrs(self.db).has_doc_notable_trait()
}
/// Returns the traits in scope, with the [`Drop`] trait removed.
pub(crate) fn traits_in_scope(&self) -> hir::VisibleTraits {
let mut traits_in_scope = self.scope.visible_traits();