[ty] Display docs for matching parameter when hovering over the name of an argument passed by keyword. (#25283)
<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:
- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
requests.)
- Does this pull request include references to any relevant issues?
- Does this PR follow our AI policy
(https://github.com/astral-sh/.github/blob/main/AI_POLICY.md)?
-->
## Summary
<!-- What's the purpose of the change? What does it do, and why? -->
This makes it so that hovering over the name of an argument passed by
keyword shows the matching parameter label and documentation rather than
the inferred type of the argument value:
```py
def test(ab: int):
"""my cool test
Args:
ab: a nice little integer
"""
return 0
test(ab=123)
^
```
````txt
(parameter) ab: int
---------------------------------------------
a nice little integer
````
Two additional notes on this new behaviour:
- For a parameter without any documentation, we will show just the
parameter label: `(parameter) ab: int`.
- We will also show the documentation for a variadic keyword parameter
(i.e., `**kwargs`) when the argument name maps to that type of
parameter.
By contrast, nothing changes when hovering over the argument value: it
will continue to show the inferred type of the value:
```py
value = 123
def test(ab: int):
"""my cool test
Args:
ab: a nice little integer
"""
return 0
test(ab=value)
^
```
````txt
Literal[123]
````
Closes https://github.com/astral-sh/ty/issues/1350.
Closes https://github.com/astral-sh/ty/issues/3538.
## Test Plan
Please see included tests.
<!-- How was it tested? --> L
Lérè committed
4a7ca062fccd80443a43aa61e5dc7e5858e88dc1
Parent: 5432709
Committed by GitHub <noreply@github.com>
on 5/27/2026, 6:59:49 PM