aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide')
-rw-r--r--crates/ra_ide/src/completion/complete_fn_param.rs37
1 files changed, 7 insertions, 30 deletions
diff --git a/crates/ra_ide/src/completion/complete_fn_param.rs b/crates/ra_ide/src/completion/complete_fn_param.rs
index 9fb5c050e..107888353 100644
--- a/crates/ra_ide/src/completion/complete_fn_param.rs
+++ b/crates/ra_ide/src/completion/complete_fn_param.rs
@@ -47,6 +47,7 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext)
47 }) 47 })
48 .for_each(|(label, lookup)| { 48 .for_each(|(label, lookup)| {
49 CompletionItem::new(CompletionKind::Magic, ctx.source_range(), label) 49 CompletionItem::new(CompletionKind::Magic, ctx.source_range(), label)
50 .kind(crate::CompletionItemKind::Binding)
50 .lookup_by(lookup) 51 .lookup_by(lookup)
51 .add_to(acc) 52 .add_to(acc)
52 }); 53 });
@@ -56,11 +57,11 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext)
56mod tests { 57mod tests {
57 use expect::{expect, Expect}; 58 use expect::{expect, Expect};
58 59
59 use crate::completion::{test_utils::do_completion, CompletionKind}; 60 use crate::completion::{test_utils::completion_list, CompletionKind};
60 61
61 fn check(ra_fixture: &str, expect: Expect) { 62 fn check(ra_fixture: &str, expect: Expect) {
62 let actual = do_completion(ra_fixture, CompletionKind::Magic); 63 let actual = completion_list(ra_fixture, CompletionKind::Magic);
63 expect.assert_debug_eq(&actual); 64 expect.assert_eq(&actual);
64 } 65 }
65 66
66 #[test] 67 #[test]
@@ -72,15 +73,7 @@ fn bar(file_id: FileId) {}
72fn baz(file<|>) {} 73fn baz(file<|>) {}
73"#, 74"#,
74 expect![[r#" 75 expect![[r#"
75 [ 76 bn file_id: FileId
76 CompletionItem {
77 label: "file_id: FileId",
78 source_range: 61..65,
79 delete: 61..65,
80 insert: "file_id: FileId",
81 lookup: "file_id",
82 },
83 ]
84 "#]], 77 "#]],
85 ); 78 );
86 } 79 }
@@ -94,15 +87,7 @@ fn bar(file_id: FileId) {}
94fn baz(file<|>, x: i32) {} 87fn baz(file<|>, x: i32) {}
95"#, 88"#,
96 expect![[r#" 89 expect![[r#"
97 [ 90 bn file_id: FileId
98 CompletionItem {
99 label: "file_id: FileId",
100 source_range: 61..65,
101 delete: 61..65,
102 insert: "file_id: FileId",
103 lookup: "file_id",
104 },
105 ]
106 "#]], 91 "#]],
107 ); 92 );
108 } 93 }
@@ -119,15 +104,7 @@ pub(crate) trait SourceRoot {
119} 104}
120"#, 105"#,
121 expect![[r#" 106 expect![[r#"
122 [ 107 bn file_id: FileId
123 CompletionItem {
124 label: "file_id: FileId",
125 source_range: 208..212,
126 delete: 208..212,
127 insert: "file_id: FileId",
128 lookup: "file_id",
129 },
130 ]
131 "#]], 108 "#]],
132 ); 109 );
133 } 110 }