@@ -186,12 +186,12 @@ impl Client {
187 arguments: R::Arguments,
187 arguments: R::Arguments,
188 ) -> Result<R::Result> {
188 ) -> Result<R::Result> {
189− let (callback_rx, mut callback_tx) = channel(1);
189+ let (callback_tx, mut callback_rx) = channel(1);
191 let arguments = Some(serde_json::to_value(arguments)?);
191 let arguments = Some(serde_json::to_value(arguments)?);
193 let req = Request {
193 let req = Request {
194− back_ch: Some(callback_rx),
194+ back_ch: Some(callback_tx),
195 seq: self.next_request_id(),
195 seq: self.next_request_id(),
196 command: R::COMMAND.to_string(),
196 command: R::COMMAND.to_string(),
197 arguments,
197 arguments,
@@ -201,7 +201,7 @@ impl Client {
201 .send(req)
201 .send(req)
202 .expect("Failed to send request to debugger");
202 .expect("Failed to send request to debugger");
204− let response = callback_tx.recv().await.unwrap()?;
204+ let response = callback_rx.recv().await.unwrap()?;
205 let response = serde_json::from_value(response.body.unwrap_or_default())?;
205 let response = serde_json::from_value(response.body.unwrap_or_default())?;
206 Ok(response)
206 Ok(response)
@@ -209,7 +209,7 @@ impl Client {
209 pub fn capabilities(&self) -> &DebuggerCapabilities {
209 pub fn capabilities(&self) -> &DebuggerCapabilities {
210 self.capabilities
210 self.capabilities
211 .as_ref()
211 .as_ref()
212− .expect("language server not yet initialized!")
212+ .expect("debugger not yet initialized!")
215 pub async fn initialize(&mut self, adapter_id: String) -> Result<()> {
215 pub async fn initialize(&mut self, adapter_id: String) -> Result<()> {
@@ -240,21 +240,19 @@ impl Client {
242 pub async fn launch(&mut self, args: serde_json::Value) -> Result<()> {
242 pub async fn launch(&mut self, args: serde_json::Value) -> Result<()> {
243− let mut initialized = self.listen_for_event("initialized".to_owned()).await;
243+ // TODO: buffer these until initialized arrives
245− let res = self.request::<requests::Launch>(args);
245+ let response = self.request::<requests::Launch>(args).await?;
246− let ev = initialized.recv();
246+ log::error!("launch response {}", response);
252 pub async fn attach(&mut self, args: serde_json::Value) -> Result<()> {
251 pub async fn attach(&mut self, args: serde_json::Value) -> Result<()> {
253− let mut initialized = self.listen_for_event("initialized".to_owned()).await;
252+ // TODO: buffer these until initialized arrives
255− let res = self.request::<requests::Attach>(args);
254+ let response = self.request::<requests::Attach>(args).await?;
256− let ev = initialized.recv();
255+ log::error!("attach response {}", response);