redhat-developer / redhat-developer/lsp4ij
"Find Usages" sends incorrect line number to `textDocument/references` on decorated function in python
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 344
- Forks
- 113
- Avg merge
- 5h 22m
- Merged PRs (30d)
- 15
Description
steps to reproduce
- clone my test repo at https://github.com/DetachHead/test/commit/9e5a8fe2d6e53e18cee73547f8bdce1536a6ab68
- run
./pw uv sync(installs basedpyright) - install the pyright for pycharm plugin
- create a python file with the following contents:
def foo[T](fn: T) -> T: ... @foo def bar(): ... - right click
barand click "Find Usages"
actual result
it shows usages of foo instead:
this is because the request is sending line 3 & character 1:
i assume it's not accounting for the decorators when determining where the function name is located.
expected result
when doing the same thing in vscode, it correctly sends line 4 & character 5:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the decorated-function case from the linked test repository and inspect the Find Usages request sent to textDocument/references. Trace the request construction in the Java LSP client, comparing the reported line and character with the working VS Code request; done means the request targets bar rather than foo.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100