curl --request POST \
--url http://localhost:4444/v1/symbol/find-references \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"identifier_position": {
"path": "src/main.py",
"position": {
"character": 5,
"line": 10
}
},
"include_code_context_lines": 5,
"include_raw_response": false
}
'import requests
url = "http://localhost:4444/v1/symbol/find-references"
payload = {
"identifier_position": {
"path": "src/main.py",
"position": {
"character": 5,
"line": 10
}
},
"include_code_context_lines": 5,
"include_raw_response": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
identifier_position: {path: 'src/main.py', position: {character: 5, line: 10}},
include_code_context_lines: 5,
include_raw_response: false
})
};
fetch('http://localhost:4444/v1/symbol/find-references', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "4444",
CURLOPT_URL => "http://localhost:4444/v1/symbol/find-references",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'identifier_position' => [
'path' => 'src/main.py',
'position' => [
'character' => 5,
'line' => 10
]
],
'include_code_context_lines' => 5,
'include_raw_response' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:4444/v1/symbol/find-references"
payload := strings.NewReader("{\n \"identifier_position\": {\n \"path\": \"src/main.py\",\n \"position\": {\n \"character\": 5,\n \"line\": 10\n }\n },\n \"include_code_context_lines\": 5,\n \"include_raw_response\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:4444/v1/symbol/find-references")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"identifier_position\": {\n \"path\": \"src/main.py\",\n \"position\": {\n \"character\": 5,\n \"line\": 10\n }\n },\n \"include_code_context_lines\": 5,\n \"include_raw_response\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:4444/v1/symbol/find-references")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"identifier_position\": {\n \"path\": \"src/main.py\",\n \"position\": {\n \"character\": 5,\n \"line\": 10\n }\n },\n \"include_code_context_lines\": 5,\n \"include_raw_response\": false\n}"
response = http.request(request)
puts response.read_body{
"references": [
{
"path": "src/main.py",
"position": {
"character": 5,
"line": 10
}
}
],
"selected_identifier": {
"file_range": {
"path": "src/main.py",
"range": {
"end": {
"character": 5,
"line": 10
},
"start": {
"character": 5,
"line": 10
}
}
},
"name": "<string>",
"kind": "<string>"
},
"context": [
{
"range": {
"path": "src/main.py",
"range": {
"end": {
"character": 5,
"line": 10
},
"start": {
"character": 5,
"line": 10
}
}
},
"source_code": "<string>"
}
],
"raw_response": "<unknown>"
}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____^
curl --request POST \
--url http://localhost:4444/v1/symbol/find-references \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"identifier_position": {
"path": "src/main.py",
"position": {
"character": 5,
"line": 10
}
},
"include_code_context_lines": 5,
"include_raw_response": false
}
'import requests
url = "http://localhost:4444/v1/symbol/find-references"
payload = {
"identifier_position": {
"path": "src/main.py",
"position": {
"character": 5,
"line": 10
}
},
"include_code_context_lines": 5,
"include_raw_response": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
identifier_position: {path: 'src/main.py', position: {character: 5, line: 10}},
include_code_context_lines: 5,
include_raw_response: false
})
};
fetch('http://localhost:4444/v1/symbol/find-references', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "4444",
CURLOPT_URL => "http://localhost:4444/v1/symbol/find-references",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'identifier_position' => [
'path' => 'src/main.py',
'position' => [
'character' => 5,
'line' => 10
]
],
'include_code_context_lines' => 5,
'include_raw_response' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:4444/v1/symbol/find-references"
payload := strings.NewReader("{\n \"identifier_position\": {\n \"path\": \"src/main.py\",\n \"position\": {\n \"character\": 5,\n \"line\": 10\n }\n },\n \"include_code_context_lines\": 5,\n \"include_raw_response\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://localhost:4444/v1/symbol/find-references")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"identifier_position\": {\n \"path\": \"src/main.py\",\n \"position\": {\n \"character\": 5,\n \"line\": 10\n }\n },\n \"include_code_context_lines\": 5,\n \"include_raw_response\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:4444/v1/symbol/find-references")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"identifier_position\": {\n \"path\": \"src/main.py\",\n \"position\": {\n \"character\": 5,\n \"line\": 10\n }\n },\n \"include_code_context_lines\": 5,\n \"include_raw_response\": false\n}"
response = http.request(request)
puts response.read_body{
"references": [
{
"path": "src/main.py",
"position": {
"character": 5,
"line": 10
}
}
],
"selected_identifier": {
"file_range": {
"path": "src/main.py",
"range": {
"end": {
"character": 5,
"line": 10
},
"start": {
"character": 5,
"line": 10
}
}
},
"name": "<string>",
"kind": "<string>"
},
"context": [
{
"range": {
"path": "src/main.py",
"range": {
"end": {
"character": 5,
"line": 10
},
"start": {
"character": 5,
"line": 10
}
}
},
"source_code": "<string>"
}
],
"raw_response": "<unknown>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
A position within a specific file in the workspace
Show child attributes
Show child attributes
Whether to include the source code of the symbol in the response. Defaults to none.
x >= 05
Whether to include the raw response from the langserver in the response. Defaults to false.
false
Response
References retrieved successfully
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}].
Show child attributes
Show child attributes
The identifier that was "clicked-on" to get the references.
Show child attributes
Show child attributes
The source code around the references.
Show child attributes
Show child attributes
The raw response from the langserver.
