diff options
author | Dmitry Sharshakov | 2021-08-13 17:40:28 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2021-08-20 04:43:54 +0000 |
commit | 541f7a051466cd8313b2aad77392c9799c81018b (patch) | |
tree | cba161bbdd083233c78cdaf84ee9dd9dd8c83811 /helix-dap/src/client.rs | |
parent | aac586b5464fef5f850d9c80bc3c9467e255977d (diff) |
Add attach command
Diffstat (limited to 'helix-dap/src/client.rs')
-rw-r--r-- | helix-dap/src/client.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/helix-dap/src/client.rs b/helix-dap/src/client.rs index f5aa8569..03e58757 100644 --- a/helix-dap/src/client.rs +++ b/helix-dap/src/client.rs @@ -393,6 +393,27 @@ impl Client { } } + pub async fn attach(&mut self, args: impl Serialize) -> Result<()> { + self.request("attach".to_owned(), to_value(args).ok()) + .await?; + + match self + .server_rx + .recv() + .await + .expect("Expected initialized event") + { + Payload::Event(Event { event, .. }) => { + if event == *"initialized" { + Ok(()) + } else { + unreachable!() + } + } + _ => unreachable!(), + } + } + pub async fn set_breakpoints( &mut self, file: String, |