Incorrect function symbol range in "callHierarchy/incomingCalls" response
- Dominant language
- Python
- Stars
- 15.6k
- Forks
- 1.8k
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 52
Description
**Describe the bug**
In `callHierarchy/incomingCalls` response, pyright returns the range of function's name node instead of the range of the function node.
This is incorrect according to the LSP spec, as the range should enclose the symbol (in this case, the function node, not just its name), and the symbol's range is inconsistent with what is returned in `textDocument/documentSymbol`.
This behavior is undesirable for LSP clients that use the caller's range in the `callHierarchy/incomingCalls` response without having to issue another `documentSymbol` request to get the correct symbol range for the caller.
**Code or Screenshots**
In the `callHierarchy/incomingCalls` response:
```json
"name": "request",
"kind": 12,
"range": {
"start": {
"line": 453,
"character": 4
},
"end": {
"line": 453,
"character": 20
}
},
"selectionRange": {
"start": {
"line": 453,
"character": 4
},
"end": {
"line": 453,
"character": 20
}
}
```
In the `textDocument/documentSymbol` response:
```json
"name": "request",
"kind": 12,
"range": {
"start": {
"line": 453,
"character": 0
},
"end": {
"line": 509,
"character": 15
}
},
"selectionRange": {
"start": {
"line": 453,
"character": 4
},
"end": {
"line": 453,
"character": 20
}
}
```
**VS Code extension or command-line**
standalone command-line pyright
Contributor guide
Research direction
Start at the implementation of callHierarchy/incomingCalls and compare how it constructs the caller range with the range returned by textDocument/documentSymbol. Reproduce the example and verify that the incoming-call range encloses the full function node while selectionRange remains the function name range.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100