on master help sign in
dap: implement threads request
commit7d2d4ed4a86f28bfce8d2fda8a774701d80f5175 authorDmitry Sharshakov <d3dx12.xx@gmail.com> dateThu 12 Aug 2021, 19:35 (5 years ago) parent5f3e806
2 files changed+22
helix-dap/examples/dap-basic.rs+1 helix-dap/src/client.rs+21
helix-dap/examples/dap-basic.rs+1
@@ -42,6 +42,7 @@ pub async fn main() -> Result<()> {
4242
4343 println!("configurationDone: {:?}", client.configuration_done().await);
4444 println!("stopped: {:?}", client.wait_for_stopped().await);
45+ println!("threads: {:#?}", client.threads().await);
4546 println!("stack trace: {:#?}", client.stack_trace(1).await);
4647
4748 let mut _in = String::new();
helix-dap/src/client.rs+21
@@ -148,6 +148,19 @@ struct StackTraceResponseBody {
148148 stack_frames: Vec<StackFrame>,
149149}
150150
151+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
152+#[serde(rename_all = "camelCase")]
153+pub struct Thread {
154+ id: usize,
155+ name: String,
156+}
157+
158+#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
159+#[serde(rename_all = "camelCase")]
160+struct ThreadsResponseBody {
161+ threads: Vec<Thread>,
162+}
163+
151164#[derive(Debug)]
152165pub struct Client {
153166 id: usize,
@@ -349,4 +362,12 @@ impl Client {
349362
350363 Ok((body.stack_frames, body.total_frames))
351364 }
365+
366+ pub async fn threads(&mut self) -> Result<Vec<Thread>> {
367+ let response = self.request("threads".to_owned(), None).await?;
368+
369+ let body: ThreadsResponseBody = from_value(response.body.unwrap()).unwrap();
370+
371+ Ok(body.threads)
372+ }
352373}