diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-26 16:29:20 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-26 16:29:20 +0000 |
commit | 4ecaad98e074c42dbf637a11afcb630aafffd7b3 (patch) | |
tree | 50832b85e65752b040affcc8d34dc5cd8c2625b9 /crates/ide_completion/src/render/function.rs | |
parent | 20e32fc946010f8c46728d6cb8bab1b96b3f48b9 (diff) | |
parent | 0e31ae2cef92f973a6ee3def3f1feaa94dcb7a4f (diff) |
Merge #8056
8056: completion relevance consider if types can be unified r=JoshMcguigan a=JoshMcguigan
This PR improves completion relevance scoring for generic types, in cases where the types could unify.
### Before
![pre-could-unify](https://user-images.githubusercontent.com/22216761/111338556-46d94e80-8634-11eb-9936-2b20eb9e6756.png)
### After
![post-could-unify](https://user-images.githubusercontent.com/22216761/111338598-4e005c80-8634-11eb-92e0-69c2c1cda6fc.png)
changelog feature improve completions
Co-authored-by: Josh Mcguigan <[email protected]>
Diffstat (limited to 'crates/ide_completion/src/render/function.rs')
-rw-r--r-- | crates/ide_completion/src/render/function.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ide_completion/src/render/function.rs b/crates/ide_completion/src/render/function.rs index b1eba20e8..d681e2c91 100644 --- a/crates/ide_completion/src/render/function.rs +++ b/crates/ide_completion/src/render/function.rs | |||
@@ -8,7 +8,7 @@ use syntax::ast::Fn; | |||
8 | use crate::{ | 8 | use crate::{ |
9 | item::{CompletionItem, CompletionItemKind, CompletionKind, CompletionRelevance, ImportEdit}, | 9 | item::{CompletionItem, CompletionItemKind, CompletionKind, CompletionRelevance, ImportEdit}, |
10 | render::{ | 10 | render::{ |
11 | builder_ext::Params, compute_exact_name_match, compute_exact_type_match, compute_ref_match, | 11 | builder_ext::Params, compute_exact_name_match, compute_ref_match, compute_type_match, |
12 | RenderContext, | 12 | RenderContext, |
13 | }, | 13 | }, |
14 | }; | 14 | }; |
@@ -73,7 +73,7 @@ impl<'a> FunctionRender<'a> { | |||
73 | 73 | ||
74 | let ret_type = self.func.ret_type(self.ctx.db()); | 74 | let ret_type = self.func.ret_type(self.ctx.db()); |
75 | item.set_relevance(CompletionRelevance { | 75 | item.set_relevance(CompletionRelevance { |
76 | exact_type_match: compute_exact_type_match(self.ctx.completion, &ret_type), | 76 | type_match: compute_type_match(self.ctx.completion, &ret_type), |
77 | exact_name_match: compute_exact_name_match(self.ctx.completion, self.name.clone()), | 77 | exact_name_match: compute_exact_name_match(self.ctx.completion, self.name.clone()), |
78 | ..CompletionRelevance::default() | 78 | ..CompletionRelevance::default() |
79 | }); | 79 | }); |