Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/inlay_hints/param_name.rs')
-rw-r--r--crates/ide/src/inlay_hints/param_name.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/ide/src/inlay_hints/param_name.rs b/crates/ide/src/inlay_hints/param_name.rs
index 08588bbed0..8dddf9d37e 100644
--- a/crates/ide/src/inlay_hints/param_name.rs
+++ b/crates/ide/src/inlay_hints/param_name.rs
@@ -37,8 +37,9 @@ pub(super) fn hints(
let hints = callable
.params()
.into_iter()
- .zip(arg_list.args())
+ .zip(arg_list.args_maybe_empty())
.filter_map(|(p, arg)| {
+ let arg = arg?;
// Only annotate hints for expressions that exist in the original file
let range = sema.original_range_opt(arg.syntax())?;
if range.file_id != file_id {
@@ -562,6 +563,19 @@ fn main() {
}
#[test]
+ fn param_name_hints_show_after_empty_arg() {
+ check_params(
+ r#"pub fn test(a: i32, b: i32, c: i32) {}
+fn main() {
+ test(, 2,);
+ //^ b
+ test(, , 3);
+ //^ c
+}"#,
+ )
+ }
+
+ #[test]
fn function_call_parameter_hint() {
check_params(
r#"