Fix types
This commit is contained in:
parent
8563ed2252
commit
8acb58b6e5
1 changed files with 11 additions and 6 deletions
|
@ -1,11 +1,10 @@
|
||||||
use agent_client_protocol as acp;
|
use agent_client_protocol::{self as acp, Agent as _};
|
||||||
use collections::HashMap;
|
use collections::HashMap;
|
||||||
use futures::channel::oneshot;
|
use futures::channel::oneshot;
|
||||||
use project::Project;
|
use project::Project;
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use util::ResultExt;
|
|
||||||
|
|
||||||
use anyhow::{Context as _, Result};
|
use anyhow::{Context as _, Result};
|
||||||
use gpui::{App, AppContext as _, AsyncApp, Entity, Task, WeakEntity};
|
use gpui::{App, AppContext as _, AsyncApp, Entity, Task, WeakEntity};
|
||||||
|
@ -15,7 +14,7 @@ use acp_thread::{AcpThread, AgentConnection, AuthRequired};
|
||||||
|
|
||||||
pub struct AcpConnection {
|
pub struct AcpConnection {
|
||||||
server_name: &'static str,
|
server_name: &'static str,
|
||||||
connection: Rc<acp::AgentConnection>,
|
connection: Rc<acp::ClientSideConnection>,
|
||||||
sessions: Rc<RefCell<HashMap<acp::SessionId, AcpSession>>>,
|
sessions: Rc<RefCell<HashMap<acp::SessionId, AcpSession>>>,
|
||||||
auth_methods: Vec<acp::AuthMethod>,
|
auth_methods: Vec<acp::AuthMethod>,
|
||||||
_io_task: Task<Result<()>>,
|
_io_task: Task<Result<()>>,
|
||||||
|
@ -51,7 +50,7 @@ impl AcpConnection {
|
||||||
sessions: sessions.clone(),
|
sessions: sessions.clone(),
|
||||||
cx: cx.clone(),
|
cx: cx.clone(),
|
||||||
};
|
};
|
||||||
let (connection, io_task) = acp::AgentConnection::new(client, stdin, stdout, {
|
let (connection, io_task) = acp::ClientSideConnection::new(client, stdin, stdout, {
|
||||||
let foreground_executor = cx.foreground_executor().clone();
|
let foreground_executor = cx.foreground_executor().clone();
|
||||||
move |fut| {
|
move |fut| {
|
||||||
foreground_executor.spawn(fut).detach();
|
foreground_executor.spawn(fut).detach();
|
||||||
|
@ -149,8 +148,14 @@ impl AgentConnection for AcpConnection {
|
||||||
.spawn(async move { Ok(conn.prompt(params).await?) })
|
.spawn(async move { Ok(conn.prompt(params).await?) })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cancel(&self, session_id: &acp::SessionId, _cx: &mut App) {
|
fn cancel(&self, session_id: &acp::SessionId, cx: &mut App) {
|
||||||
self.connection.cancel(session_id.clone()).log_err();
|
let conn = self.connection.clone();
|
||||||
|
let params = acp::CancelledNotification {
|
||||||
|
session_id: session_id.clone(),
|
||||||
|
};
|
||||||
|
cx.foreground_executor()
|
||||||
|
.spawn(async move { conn.cancelled(params).await })
|
||||||
|
.detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue