| 154 | // ── Helper: completion labels at a position ───────────────────────── |
| 155 | |
| 156 | async fn completion_labels( |
| 157 | backend: &phpantom_lsp::Backend, |
| 158 | uri: &str, |
| 159 | line: u32, |
| 160 | col: u32, |
| 161 | ) -> Vec<String> { |
| 162 | let params = CompletionParams { |
| 163 | text_document_position: TextDocumentPositionParams { |
| 164 | text_document: TextDocumentIdentifier { |
| 165 | uri: Url::parse(uri).unwrap(), |
| 166 | }, |
| 167 | position: Position { |
| 168 | line, |
| 169 | character: col, |
| 170 | }, |
| 171 | }, |
| 172 | work_done_progress_params: WorkDoneProgressParams::default(), |
| 173 | partial_result_params: PartialResultParams::default(), |
| 174 | context: Some(CompletionContext { |
| 175 | trigger_kind: CompletionTriggerKind::TRIGGER_CHARACTER, |
| 176 | trigger_character: Some(">".to_string()), |
| 177 | }), |
| 178 | }; |
| 179 | let result = backend.completion(params).await.unwrap(); |
| 180 | match result { |
| 181 | Some(CompletionResponse::Array(items)) => items.into_iter().map(|i| i.label).collect(), |
| 182 | Some(CompletionResponse::List(list)) => { |
| 183 | list.items.into_iter().map(|i| i.label).collect() |
| 184 | } |
| 185 | None => vec![], |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | // ── Helper: GTD returns something ─────────────────────────────────── |
| 190 | |