POST
/
symbol
/
find-definition

Body

application/json
include_raw_response
boolean

Whether to include the raw response from the langserver in the response. Defaults to false.

include_source_code
boolean

Whether to include the source code around the symbol's identifier in the response. Defaults to false. TODO: Implement this

position
object
required

Specific position within a file.

Response

200 - application/json

Response to a definition request.

The definition(s) of the symbol. Points to the start position of the symbol's identifier.

e.g. for the definition of User on line 5 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)
__________^

The definition(s) will be [{"path": "src/main.py", "line": 0, "character": 6}].

definitions
object[]
required
raw_response
any

The raw response from the langserver.

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_definition

source_code_context
object[] | null

The source code of symbol definitions.