(stdin: &mut tokio::process::ChildStdin, value: Value)
| 334 | } |
| 335 | |
| 336 | async fn write_message(stdin: &mut tokio::process::ChildStdin, value: Value) -> Result<()> { |
| 337 | let body = serde_json::to_vec(&value).map_err(|e| TraceDecayError::Config { |
| 338 | message: format!("failed to encode LSP message: {e}"), |
| 339 | })?; |
| 340 | let header = format!("Content-Length: {}\r\n\r\n", body.len()); |
| 341 | stdin |
| 342 | .write_all(header.as_bytes()) |
| 343 | .await |
| 344 | .map_err(|e| TraceDecayError::Config { |
| 345 | message: format!("failed to write LSP message: {e}"), |
| 346 | })?; |
| 347 | stdin |
| 348 | .write_all(&body) |
| 349 | .await |
| 350 | .map_err(|e| TraceDecayError::Config { |
| 351 | message: format!("failed to write LSP message: {e}"), |
| 352 | })?; |
| 353 | stdin.flush().await.map_err(|e| TraceDecayError::Config { |
| 354 | message: format!("failed to flush LSP message: {e}"), |
| 355 | }) |
| 356 | } |
| 357 | |
| 358 | async fn write_message_with_timeout( |
| 359 | stdin: &mut tokio::process::ChildStdin, |
no test coverage detected