diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_fn_param.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_fn_param.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_fn_param.rs b/crates/ra_ide_api/src/completion/complete_fn_param.rs index c1739e47e..e3d1470c2 100644 --- a/crates/ra_ide_api/src/completion/complete_fn_param.rs +++ b/crates/ra_ide_api/src/completion/complete_fn_param.rs | |||
@@ -34,7 +34,7 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext) | |||
34 | } | 34 | } |
35 | }) | 35 | }) |
36 | .for_each(|(label, lookup)| { | 36 | .for_each(|(label, lookup)| { |
37 | CompletionItem::new(CompletionKind::Magic, label) | 37 | CompletionItem::new(CompletionKind::Magic, ctx, label) |
38 | .lookup_by(lookup) | 38 | .lookup_by(lookup) |
39 | .add_to(acc) | 39 | .add_to(acc) |
40 | }); | 40 | }); |
@@ -56,38 +56,40 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext) | |||
56 | #[cfg(test)] | 56 | #[cfg(test)] |
57 | mod tests { | 57 | mod tests { |
58 | use crate::completion::*; | 58 | use crate::completion::*; |
59 | use crate::completion::completion_item::check_completion; | ||
59 | 60 | ||
60 | fn check_magic_completion(code: &str, expected_completions: &str) { | 61 | fn check_magic_completion(name: &str, code: &str) { |
61 | check_completion(code, expected_completions, CompletionKind::Magic); | 62 | check_completion(name, code, CompletionKind::Magic); |
62 | } | 63 | } |
63 | 64 | ||
64 | #[test] | 65 | #[test] |
65 | fn test_param_completion_last_param() { | 66 | fn test_param_completion_last_param() { |
66 | check_magic_completion( | 67 | check_magic_completion( |
68 | "param_completion_last_param", | ||
67 | r" | 69 | r" |
68 | fn foo(file_id: FileId) {} | 70 | fn foo(file_id: FileId) {} |
69 | fn bar(file_id: FileId) {} | 71 | fn bar(file_id: FileId) {} |
70 | fn baz(file<|>) {} | 72 | fn baz(file<|>) {} |
71 | ", | 73 | ", |
72 | r#"file_id "file_id: FileId""#, | ||
73 | ); | 74 | ); |
74 | } | 75 | } |
75 | 76 | ||
76 | #[test] | 77 | #[test] |
77 | fn test_param_completion_nth_param() { | 78 | fn test_param_completion_nth_param() { |
78 | check_magic_completion( | 79 | check_magic_completion( |
80 | "param_completion_nth_param", | ||
79 | r" | 81 | r" |
80 | fn foo(file_id: FileId) {} | 82 | fn foo(file_id: FileId) {} |
81 | fn bar(file_id: FileId) {} | 83 | fn bar(file_id: FileId) {} |
82 | fn baz(file<|>, x: i32) {} | 84 | fn baz(file<|>, x: i32) {} |
83 | ", | 85 | ", |
84 | r#"file_id "file_id: FileId""#, | ||
85 | ); | 86 | ); |
86 | } | 87 | } |
87 | 88 | ||
88 | #[test] | 89 | #[test] |
89 | fn test_param_completion_trait_param() { | 90 | fn test_param_completion_trait_param() { |
90 | check_magic_completion( | 91 | check_magic_completion( |
92 | "param_completion_trait_param", | ||
91 | r" | 93 | r" |
92 | pub(crate) trait SourceRoot { | 94 | pub(crate) trait SourceRoot { |
93 | pub fn contains(&self, file_id: FileId) -> bool; | 95 | pub fn contains(&self, file_id: FileId) -> bool; |
@@ -96,7 +98,6 @@ mod tests { | |||
96 | pub fn syntax(&self, file<|>) | 98 | pub fn syntax(&self, file<|>) |
97 | } | 99 | } |
98 | ", | 100 | ", |
99 | r#"file_id "file_id: FileId""#, | ||
100 | ); | 101 | ); |
101 | } | 102 | } |
102 | } | 103 | } |