aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/render.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion/src/render.rs')
-rw-r--r--crates/ide_completion/src/render.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs
index f7f9084d9..db31896e5 100644
--- a/crates/ide_completion/src/render.rs
+++ b/crates/ide_completion/src/render.rs
@@ -20,7 +20,7 @@ use ide_db::{
20use syntax::TextRange; 20use syntax::TextRange;
21 21
22use crate::{ 22use crate::{
23 item::{ImportEdit, Relevance}, 23 item::{CompletionRelevance, ImportEdit},
24 CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, 24 CompletionContext, CompletionItem, CompletionItemKind, CompletionKind,
25}; 25};
26 26
@@ -322,9 +322,9 @@ impl<'a> Render<'a> {
322 } 322 }
323} 323}
324 324
325fn compute_relevance(ctx: &RenderContext, ty: &Type, name: &str) -> Option<Relevance> { 325fn compute_relevance(ctx: &RenderContext, ty: &Type, name: &str) -> Option<CompletionRelevance> {
326 let (expected_name, expected_type) = ctx.expected_name_and_type()?; 326 let (expected_name, expected_type) = ctx.expected_name_and_type()?;
327 let mut res = Relevance::default(); 327 let mut res = CompletionRelevance::default();
328 res.exact_type_match = ty == &expected_type; 328 res.exact_type_match = ty == &expected_type;
329 res.exact_name_match = name == &expected_name; 329 res.exact_name_match = name == &expected_name;
330 Some(res) 330 Some(res)
@@ -338,7 +338,7 @@ mod tests {
338 338
339 use crate::{ 339 use crate::{
340 test_utils::{check_edit, do_completion, get_all_items, TEST_CONFIG}, 340 test_utils::{check_edit, do_completion, get_all_items, TEST_CONFIG},
341 CompletionKind, Relevance, 341 CompletionKind, CompletionRelevance,
342 }; 342 };
343 343
344 fn check(ra_fixture: &str, expect: Expect) { 344 fn check(ra_fixture: &str, expect: Expect) {
@@ -347,12 +347,14 @@ mod tests {
347 } 347 }
348 348
349 fn check_relevance(ra_fixture: &str, expect: Expect) { 349 fn check_relevance(ra_fixture: &str, expect: Expect) {
350 fn display_relevance(relevance: Relevance) -> &'static str { 350 fn display_relevance(relevance: CompletionRelevance) -> &'static str {
351 match relevance { 351 match relevance {
352 Relevance { exact_type_match: true, exact_name_match: true } => "[type+name]", 352 CompletionRelevance { exact_type_match: true, exact_name_match: true } => {
353 Relevance { exact_type_match: true, exact_name_match: false } => "[type]", 353 "[type+name]"
354 Relevance { exact_type_match: false, exact_name_match: true } => "[name]", 354 }
355 Relevance { exact_type_match: false, exact_name_match: false } => "[]", 355 CompletionRelevance { exact_type_match: true, exact_name_match: false } => "[type]",
356 CompletionRelevance { exact_type_match: false, exact_name_match: true } => "[name]",
357 CompletionRelevance { exact_type_match: false, exact_name_match: false } => "[]",
356 } 358 }
357 } 359 }
358 360
@@ -975,7 +977,7 @@ fn main() {
975 Local, 977 Local,
976 ), 978 ),
977 detail: "S", 979 detail: "S",
978 relevance: Relevance { 980 relevance: CompletionRelevance {
979 exact_name_match: true, 981 exact_name_match: true,
980 exact_type_match: false, 982 exact_type_match: false,
981 }, 983 },