aboutsummaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-10-17 05:06:52 +0000
committerBlaž Hrastnik2021-10-17 05:06:52 +0000
commitbda05ec4bfb861c9880dd700ab31c1f9bc79e926 (patch)
tree83f5dfd3faafcff26def96935def03e91ab03ce0 /helix-term
parent83a816740268ec527bf2f908cf752cfcbedc81f9 (diff)
Use a newtype for ThreadId
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/application.rs7
-rw-r--r--helix-term/src/commands/dap.rs6
2 files changed, 9 insertions, 4 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index d8ff2a8a..27062a36 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -320,7 +320,12 @@ impl Application {
for thread in threads {
fetch_stack_trace(debugger, thread.id).await;
}
- select_thread_id(&mut self.editor, thread_id.unwrap_or(0), false).await;
+ select_thread_id(
+ &mut self.editor,
+ thread_id.unwrap_or_default(),
+ false,
+ )
+ .await;
}
} else if let Some(thread_id) = thread_id {
debugger.thread_states.insert(thread_id, reason.clone()); // TODO: dap uses "type" || "reason" here
diff --git a/helix-term/src/commands/dap.rs b/helix-term/src/commands/dap.rs
index a7cf7e81..6df9be22 100644
--- a/helix-term/src/commands/dap.rs
+++ b/helix-term/src/commands/dap.rs
@@ -6,7 +6,7 @@ use crate::{
ui::{FilePicker, Prompt, PromptEvent},
};
use helix_core::{syntax::DebugConfigCompletion, Selection};
-use helix_dap::{self as dap, Client};
+use helix_dap::{self as dap, Client, ThreadId};
use helix_lsp::block_on;
use serde_json::{to_value, Value};
@@ -34,7 +34,7 @@ pub fn resume_application(debugger: &mut Client) {
debugger.thread_id = None;
}
-pub async fn select_thread_id(editor: &mut Editor, thread_id: isize, force: bool) {
+pub async fn select_thread_id(editor: &mut Editor, thread_id: ThreadId, force: bool) {
let debugger = match &mut editor.debugger {
Some(debugger) => debugger,
None => return,
@@ -53,7 +53,7 @@ pub async fn select_thread_id(editor: &mut Editor, thread_id: isize, force: bool
}
}
-pub async fn fetch_stack_trace(debugger: &mut Client, thread_id: isize) {
+pub async fn fetch_stack_trace(debugger: &mut Client, thread_id: ThreadId) {
let (frames, _) = match debugger.stack_trace(thread_id).await {
Ok(frames) => frames,
Err(_) => return,