Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

debugger: Fix new session modal not having worktree scenarios (#29453)

Piotr Osiewiczd46890978aea
diff --git a/crates/debugger_ui/src/new_session_modal.rs b/crates/debugger_ui/src/new_session_modal.rs
index 516ca7edfa2..d774575169b 100644
--- a/crates/debugger_ui/src/new_session_modal.rs
+++ b/crates/debugger_ui/src/new_session_modal.rs
@@ -197,6 +197,11 @@ impl NewSessionModal {
let workspace = self.workspace.clone();
let weak = cx.weak_entity();
let last_profile = self.last_selected_profile_name.clone();
+ let worktree = workspace
+ .update(cx, |this, cx| {
+ this.project().read(cx).visible_worktrees(cx).next()
+ })
+ .unwrap_or_default();
DropdownMenu::new(
"debug-config-menu",
last_profile.unwrap_or_else(|| SELECT_SCENARIO_LABEL.clone()),
@@ -250,7 +255,9 @@ impl NewSessionModal {
.task_inventory()
.iter()
.flat_map(|task_inventory| {
- task_inventory.read(cx).list_debug_scenarios(None)
+ task_inventory.read(cx).list_debug_scenarios(
+ worktree.as_ref().map(|worktree| worktree.read(cx).id()),
+ )
})
.collect()
})
diff --git a/crates/project/src/task_inventory.rs b/crates/project/src/task_inventory.rs
index a93b8f9037a..efeb447b6a8 100644
--- a/crates/project/src/task_inventory.rs
+++ b/crates/project/src/task_inventory.rs
@@ -555,6 +555,7 @@ impl Inventory {
});
}
};
+
let new_templates = raw_tasks.into_iter().filter_map(|raw_template| {
serde_json::from_value::<DebugScenario>(raw_template).log_err()
});
diff --git a/crates/task/src/debug_format.rs b/crates/task/src/debug_format.rs
index 129db722c99..f25243df877 100644
--- a/crates/task/src/debug_format.rs
+++ b/crates/task/src/debug_format.rs
@@ -59,6 +59,7 @@ pub struct LaunchRequest {
/// The program that you trying to debug
pub program: String,
/// The current working directory of your project
+ #[serde(default)]
pub cwd: Option<PathBuf>,
/// Arguments to pass to a debuggee
#[serde(default)]
@@ -155,6 +156,7 @@ pub struct DebugScenario {
/// Name of the debug task
pub label: SharedString,
/// A task to run prior to spawning the debuggee.
+ #[serde(default)]
pub build: Option<SharedString>,
#[serde(flatten)]
pub request: Option<DebugRequest>,