aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/call_info.rs4
-rw-r--r--crates/ra_ide/src/completion/presentation.rs16
2 files changed, 20 insertions, 0 deletions
diff --git a/crates/ra_ide/src/call_info.rs b/crates/ra_ide/src/call_info.rs
index 14980afdd..ff602202f 100644
--- a/crates/ra_ide/src/call_info.rs
+++ b/crates/ra_ide/src/call_info.rs
@@ -161,6 +161,10 @@ impl ActiveParameter {
161 161
162 let idx = active_parameter?; 162 let idx = active_parameter?;
163 let mut params = signature.params(sema.db); 163 let mut params = signature.params(sema.db);
164 if !(idx < params.len()) {
165 mark::hit!(too_many_arguments);
166 return None;
167 }
164 let (pat, ty) = params.swap_remove(idx); 168 let (pat, ty) = params.swap_remove(idx);
165 let name = pat?.to_string(); 169 let name = pat?.to_string();
166 Some(ActiveParameter { ty, name }) 170 Some(ActiveParameter { ty, name })
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs
index c7b74e635..9a94ff476 100644
--- a/crates/ra_ide/src/completion/presentation.rs
+++ b/crates/ra_ide/src/completion/presentation.rs
@@ -1160,6 +1160,22 @@ fn go(world: &WorldSnapshot) { go(w<|>) }
1160 } 1160 }
1161 1161
1162 #[test] 1162 #[test]
1163 fn too_many_arguments() {
1164 mark::check!(too_many_arguments);
1165 check_scores(
1166 r#"
1167struct Foo;
1168fn f(foo: &Foo) { f(foo, w<|>) }
1169"#,
1170 expect![[r#"
1171 st Foo []
1172 fn f(…) []
1173 bn foo []
1174 "#]],
1175 );
1176 }
1177
1178 #[test]
1163 fn guesses_macro_braces() { 1179 fn guesses_macro_braces() {
1164 check_edit( 1180 check_edit(
1165 "vec!", 1181 "vec!",