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

@ -79,6 +79,11 @@ fn render(
.and_then(|trait_| trait_.containing_trait_or_trait_impl(ctx.db()))
.map_or(false, |trait_| completion.is_ops_trait(trait_));
let is_item_from_notable_trait = func
.as_assoc_item(ctx.db())
.and_then(|trait_| trait_.containing_trait(ctx.db()))
.map_or(false, |trait_| completion.is_doc_notable_trait(trait_));
let (has_dot_receiver, has_call_parens, cap) = match func_kind {
FuncKind::Function(&PathCompletionCtx {
kind: PathKind::Expr { .. },
@ -105,6 +110,7 @@ fn render(
},
exact_name_match: compute_exact_name_match(completion, &call),
is_op_method,
is_item_from_notable_trait,
..ctx.completion_relevance()
});