Skip to content

Commit 24dca9f

Browse files
committed
Reduce completion score for deprecated items
1 parent 60cc5f2 commit 24dca9f

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

crates/ide-completion/src/item.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl CompletionRelevance {
286286
function,
287287
is_skipping_completion,
288288
has_local_inherent_impl,
289-
is_deprecated: _,
289+
is_deprecated,
290290
} = self;
291291

292292
// only applicable for completions within use items
@@ -363,6 +363,11 @@ impl CompletionRelevance {
363363
score -= 5;
364364
}
365365

366+
// lower rank for deprecated items
367+
if is_deprecated {
368+
score -= 5;
369+
}
370+
366371
score
367372
}
368373

crates/ide-completion/src/render.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3802,10 +3802,10 @@ fn main() {
38023802
}
38033803
"#,
38043804
expect![[r#"
3805-
ct INFINITY f32 [type_could_unify+requires_import+deprecated]
3806-
ct NEG_INFINITY f32 [type_could_unify+requires_import+deprecated]
38073805
ct INFINITY pub const INFINITY: f32 []
38083806
ct NEG_INFINITY pub const NEG_INFINITY: f32 []
3807+
ct INFINITY f32 [type_could_unify+requires_import+deprecated]
3808+
ct NEG_INFINITY f32 [type_could_unify+requires_import+deprecated]
38093809
"#]],
38103810
);
38113811
}

0 commit comments

Comments
 (0)