Find all references to a symbol
The input position should point to the identifier of the symbol you want to get the references for.
Returns a list of locations where the symbol at the given position is referenced.
The returned positions point to the start of the reference identifier.
e.g. for User
on line 0 of src/main.py
:
0: class User:
input____^^^^
1: def __init__(self, name, age):
2: self.name = name
3: self.age = age
4:
5: user = User("John", 30)
output____^
Body
Specific position within a file.
Whether to include the source code of the symbol in the response. Defaults to none.
Whether to include the declaration (definition) of the symbol in the response. Defaults to false.
Whether to include the raw response from the langserver in the response. Defaults to false.
Response
Response to a references request.
Points to the start position of the symbol's identifier.
e.g. for the references of User
on line 0 character 6 of src/main.py
with the code:
0: class User:
1: def __init__(self, name, age):
2: self.name = name
3: self.age = age
4:
5: user = User("John", 30)
_________^
6:
7: print(user.name)
The references will be [{"path": "src/main.py", "line": 5, "character": 7}]
.
The source code around the references.
The raw response from the langserver.
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_references