Helper: send a find-references request and return the locations.
(
backend: &Backend,
uri: &Url,
line: u32,
character: u32,
include_declaration: bool,
)
| 17 | |
| 18 | /// Helper: send a find-references request and return the locations. |
| 19 | async fn find_references( |
| 20 | backend: &Backend, |
| 21 | uri: &Url, |
| 22 | line: u32, |
| 23 | character: u32, |
| 24 | include_declaration: bool, |
| 25 | ) -> Vec<Location> { |
| 26 | let params = ReferenceParams { |
| 27 | text_document_position: TextDocumentPositionParams { |
| 28 | text_document: TextDocumentIdentifier { uri: uri.clone() }, |
| 29 | position: Position { line, character }, |
| 30 | }, |
| 31 | work_done_progress_params: WorkDoneProgressParams::default(), |
| 32 | partial_result_params: PartialResultParams::default(), |
| 33 | context: ReferenceContext { |
| 34 | include_declaration, |
| 35 | }, |
| 36 | }; |
| 37 | |
| 38 | backend |
| 39 | .references(params) |
| 40 | .await |
| 41 | .unwrap() |
| 42 | .unwrap_or_default() |
| 43 | } |
| 44 | |
| 45 | // ─── Variable References ──────────────────────────────────────────────────── |
| 46 |
no test coverage detected