| 9 | // ─── Helpers ──────────────────────────────────────────────────────────────── |
| 10 | |
| 11 | async fn implementation_at( |
| 12 | backend: &phpantom_lsp::Backend, |
| 13 | uri: &Url, |
| 14 | line: u32, |
| 15 | character: u32, |
| 16 | ) -> Vec<Location> { |
| 17 | let params = GotoImplementationParams { |
| 18 | text_document_position_params: TextDocumentPositionParams { |
| 19 | text_document: TextDocumentIdentifier { uri: uri.clone() }, |
| 20 | position: Position { line, character }, |
| 21 | }, |
| 22 | work_done_progress_params: WorkDoneProgressParams::default(), |
| 23 | partial_result_params: PartialResultParams::default(), |
| 24 | }; |
| 25 | |
| 26 | match backend.goto_implementation(params).await.unwrap() { |
| 27 | Some(GotoImplementationResponse::Scalar(loc)) => vec![loc], |
| 28 | Some(GotoImplementationResponse::Array(locs)) => locs, |
| 29 | Some(GotoImplementationResponse::Link(links)) => links |
| 30 | .into_iter() |
| 31 | .map(|l| Location { |
| 32 | uri: l.target_uri, |
| 33 | range: l.target_selection_range, |
| 34 | }) |
| 35 | .collect(), |
| 36 | None => vec![], |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | async fn open(backend: &phpantom_lsp::Backend, uri: &Url, text: &str) { |
| 41 | backend |