(
&self,
path: &Path,
line: u32,
character: u32,
)
| 431 | } |
| 432 | |
| 433 | pub async fn completion( |
| 434 | &self, |
| 435 | path: &Path, |
| 436 | line: u32, |
| 437 | character: u32, |
| 438 | ) -> Result<Option<Vec<lsp_types::CompletionItem>>, LspError> { |
| 439 | let uri = path_to_uri(path)?; |
| 440 | |
| 441 | let params = lsp_types::CompletionParams { |
| 442 | text_document_position: lsp_types::TextDocumentPositionParams { |
| 443 | text_document: TextDocumentIdentifier { uri }, |
| 444 | position: lsp_types::Position { line, character }, |
| 445 | }, |
| 446 | work_done_progress_params: Default::default(), |
| 447 | partial_result_params: Default::default(), |
| 448 | context: None, |
| 449 | }; |
| 450 | |
| 451 | let result = self |
| 452 | .request("textDocument/completion", serde_json::to_value(params)?) |
| 453 | .await?; |
| 454 | |
| 455 | if result.is_null() { |
| 456 | return Ok(None); |
| 457 | } |
| 458 | |
| 459 | let response: lsp_types::CompletionResponse = serde_json::from_value(result)?; |
| 460 | Ok(Some(match response { |
| 461 | lsp_types::CompletionResponse::Array(items) => items, |
| 462 | lsp_types::CompletionResponse::List(list) => list.items, |
| 463 | })) |
| 464 | } |
| 465 | |
| 466 | pub async fn references( |
| 467 | &self, |
nothing calls this directly
no test coverage detected