From 1f284df0023911e1966fd14bbabc90dbc027497f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Thu, 3 Jul 2025 10:54:47 -0600 Subject: [PATCH] WIP --- crates/acp/src/acp.rs | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/crates/acp/src/acp.rs b/crates/acp/src/acp.rs index 2af60300b61af7da554805553ef95a02b0145ff1..6e0c2e399919b3bf9b286e7904fc752cc362485a 100644 --- a/crates/acp/src/acp.rs +++ b/crates/acp/src/acp.rs @@ -808,17 +808,29 @@ mod tests { fake_server.on_user_message(move |params, server, mut cx| async move { server .update(&mut cx, |server, cx| { - let future = - server - .connection - .request(acp::StreamAssistantMessageChunkParams { - thread_id: params.thread_id, - chunk: acp::AssistantMessageChunk::Thought { - chunk: "Thinking ".into(), - }, - }); - - cx.spawn(async move |_, _| future.await) + server.send_to_zed( + acp::StreamAssistantMessageChunkParams { + thread_id: params.thread_id.clone(), + chunk: acp::AssistantMessageChunk::Thought { + chunk: "Thinking ".into(), + }, + }, + cx, + ) + })? + .await + .unwrap(); + server + .update(&mut cx, |server, cx| { + server.send_to_zed( + acp::StreamAssistantMessageChunkParams { + thread_id: params.thread_id, + chunk: acp::AssistantMessageChunk::Thought { + chunk: "hard!".into(), + }, + }, + cx, + ) })? .await .unwrap(); @@ -1191,5 +1203,14 @@ mod tests { handler(request, server, cx).boxed_local() })); } + + fn send_to_zed( + &self, + message: T, + cx: &Context, + ) -> Task> { + let future = self.connection.request(message); + cx.foreground_executor().spawn(future) + } } }