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

@ -207,6 +207,13 @@ impl Attrs {
})
}
pub fn has_doc_notable_trait(&self) -> bool {
self.by_key("doc").tt_values().any(|tt| {
tt.delimiter.kind == DelimiterKind::Parenthesis &&
matches!(&*tt.token_trees, [tt::TokenTree::Leaf(tt::Leaf::Ident(ident))] if ident.text == "notable_trait")
})
}
pub fn doc_exprs(&self) -> impl Iterator<Item = DocExpr> + '_ {
self.by_key("doc").tt_values().map(DocExpr::parse)
}