on master help sign in
compat: make thread IDs signed

Delve needs it

commitcf7237d0b920eeb7d887c192bc46c44990cc9b68 authorDmitry Sharshakov <d3dx12.xx@gmail.com> dateFri 3 Sep 2021, 23:11 (5 years ago) parentc63ad60
3 files changed+20−20
helix-dap/src/client.rs+9−9 helix-dap/src/types.rs+10−10 helix-term/src/commands/dap.rs+1−1
helix-dap/src/client.rs+9−9
@@ -28,9 +28,9 @@ pub struct Client {
2828 request_counter: AtomicU64,
2929 pub caps: Option<DebuggerCapabilities>,
3030 // thread_id -> frames
31− pub stack_frames: HashMap<usize, Vec<StackFrame>>,
32− pub thread_states: HashMap<usize, String>,
33− pub thread_id: Option<usize>,
31+ pub stack_frames: HashMap<isize, Vec<StackFrame>>,
32+ pub thread_states: HashMap<isize, String>,
33+ pub thread_id: Option<isize>,
3434 /// Currently active frame for the current thread.
3535 pub active_frame: Option<usize>,
3636}
@@ -298,7 +298,7 @@ impl Client {
298298 self.request::<requests::ConfigurationDone>(()).await
299299 }
300300
301− pub async fn continue_thread(&mut self, thread_id: usize) -> Result<Option<bool>> {
301+ pub async fn continue_thread(&mut self, thread_id: isize) -> Result<Option<bool>> {
302302 let args = requests::ContinueArguments { thread_id };
303303
304304 let response = self.request::<requests::Continue>(args).await?;
@@ -307,7 +307,7 @@ impl Client {
307307
308308 pub async fn stack_trace(
309309 &mut self,
310− thread_id: usize,
310+ thread_id: isize,
311311 ) -> Result<(Vec<StackFrame>, Option<usize>)> {
312312 let args = requests::StackTraceArguments {
313313 thread_id,
@@ -345,7 +345,7 @@ impl Client {
345345 Ok(response.variables)
346346 }
347347
348− pub async fn step_in(&mut self, thread_id: usize) -> Result<()> {
348+ pub async fn step_in(&mut self, thread_id: isize) -> Result<()> {
349349 let args = requests::StepInArguments {
350350 thread_id,
351351 target_id: None,
@@ -355,7 +355,7 @@ impl Client {
355355 self.request::<requests::StepIn>(args).await
356356 }
357357
358− pub async fn step_out(&mut self, thread_id: usize) -> Result<()> {
358+ pub async fn step_out(&mut self, thread_id: isize) -> Result<()> {
359359 let args = requests::StepOutArguments {
360360 thread_id,
361361 granularity: None,
@@ -364,7 +364,7 @@ impl Client {
364364 self.request::<requests::StepOut>(args).await
365365 }
366366
367− pub async fn next(&mut self, thread_id: usize) -> Result<()> {
367+ pub async fn next(&mut self, thread_id: isize) -> Result<()> {
368368 let args = requests::NextArguments {
369369 thread_id,
370370 granularity: None,
@@ -373,7 +373,7 @@ impl Client {
373373 self.request::<requests::Next>(args).await
374374 }
375375
376− pub async fn pause(&mut self, thread_id: usize) -> Result<()> {
376+ pub async fn pause(&mut self, thread_id: isize) -> Result<()> {
377377 let args = requests::PauseArguments { thread_id };
378378
379379 self.request::<requests::Pause>(args).await
helix-dap/src/types.rs+10−10
@@ -157,7 +157,7 @@ pub struct StackFrame {
157157#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
158158#[serde(rename_all = "camelCase")]
159159pub struct Thread {
160− pub id: usize,
160+ pub id: isize,
161161 pub name: String,
162162}
163163
@@ -317,7 +317,7 @@ pub mod requests {
317317 #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
318318 #[serde(rename_all = "camelCase")]
319319 pub struct ContinueArguments {
320− pub thread_id: usize,
320+ pub thread_id: isize,
321321 }
322322
323323 #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
@@ -338,7 +338,7 @@ pub mod requests {
338338 #[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
339339 #[serde(rename_all = "camelCase")]
340340 pub struct StackTraceArguments {
341− pub thread_id: usize,
341+ pub thread_id: isize,
342342 pub start_frame: Option<usize>,
343343 pub levels: Option<usize>,
344344 pub format: Option<StackFrameFormat>,
@@ -424,7 +424,7 @@ pub mod requests {
424424 #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
425425 #[serde(rename_all = "camelCase")]
426426 pub struct StepInArguments {
427− pub thread_id: usize,
427+ pub thread_id: isize,
428428 pub target_id: Option<usize>,
429429 pub granularity: Option<String>,
430430 }
@@ -441,7 +441,7 @@ pub mod requests {
441441 #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
442442 #[serde(rename_all = "camelCase")]
443443 pub struct StepOutArguments {
444− pub thread_id: usize,
444+ pub thread_id: isize,
445445 pub granularity: Option<String>,
446446 }
447447
@@ -457,7 +457,7 @@ pub mod requests {
457457 #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
458458 #[serde(rename_all = "camelCase")]
459459 pub struct NextArguments {
460− pub thread_id: usize,
460+ pub thread_id: isize,
461461 pub granularity: Option<String>,
462462 }
463463
@@ -473,7 +473,7 @@ pub mod requests {
473473 #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
474474 #[serde(rename_all = "camelCase")]
475475 pub struct PauseArguments {
476− pub thread_id: usize,
476+ pub thread_id: isize,
477477 }
478478
479479 #[derive(Debug)]
@@ -551,7 +551,7 @@ pub mod events {
551551 pub struct Stopped {
552552 pub reason: String,
553553 pub description: Option<String>,
554− pub thread_id: Option<usize>,
554+ pub thread_id: Option<isize>,
555555 pub preserve_focus_hint: Option<bool>,
556556 pub text: Option<String>,
557557 pub all_threads_stopped: Option<bool>,
@@ -561,7 +561,7 @@ pub mod events {
561561 #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
562562 #[serde(rename_all = "camelCase")]
563563 pub struct Continued {
564− pub thread_id: usize,
564+ pub thread_id: isize,
565565 pub all_threads_continued: Option<bool>,
566566 }
567567
@@ -581,7 +581,7 @@ pub mod events {
581581 #[serde(rename_all = "camelCase")]
582582 pub struct Thread {
583583 pub reason: String,
584− pub thread_id: usize,
584+ pub thread_id: isize,
585585 }
586586
587587 #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
helix-term/src/commands/dap.rs+1−1
@@ -29,7 +29,7 @@ pub fn resume_application(debugger: &mut Client) {
2929 debugger.thread_id = None;
3030}
3131
32−pub async fn select_thread_id(editor: &mut Editor, thread_id: usize, force: bool) {
32+pub async fn select_thread_id(editor: &mut Editor, thread_id: isize, force: bool) {
3333 let debugger = match &mut editor.debugger {
3434 Some(debugger) => debugger,
3535 None => return,