fix: Fix param inlayHints on empty expr and comma

Example
---
```rust
pub fn test(a: i32, b: i32, c: i32) {}
fn main() {
    test(, 2,);
    test(, , 3);
}
```

**Before this PR**

```rust
    test(, 2,);
         //^ a
    test(, , 3);
           //^ a
```

**After this PR**

```rust
    test(, 2,);
         //^ b
    test(, , 3);
           //^ c
```
This commit is contained in:
A4-Tacks
2026-04-01 11:09:56 +08:00
parent b2c6beb7e0
commit fcd9c36f3b
@@ -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 {
@@ -561,6 +562,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(