Add the ability for tasks to target the center pane (#22004)
Closes #20060 Closes #20720 Closes #19873 Closes #9445 Release Notes: - Fixed a bug where tasks would be spawned with their working directory set to a file in some cases - Added the ability to spawn tasks in the center pane, when spawning from a keybinding: ```json5 [ { // Assuming you have a task labeled "echo hello" "ctrl--": [ "task::Spawn", { "task_name": "echo hello", "target": "center" } ] } ] ```
This commit is contained in:
parent
85c3aec6e7
commit
4f96706161
18 changed files with 263 additions and 106 deletions
|
@ -177,7 +177,7 @@ impl Inventory {
|
|||
let id_base = kind.to_id_base();
|
||||
Some((
|
||||
kind,
|
||||
task.resolve_task(&id_base, task_context)?,
|
||||
task.resolve_task(&id_base, Default::default(), task_context)?,
|
||||
not_used_score,
|
||||
))
|
||||
})
|
||||
|
@ -397,7 +397,7 @@ mod test_inventory {
|
|||
let id_base = task_source_kind.to_id_base();
|
||||
inventory.task_scheduled(
|
||||
task_source_kind.clone(),
|
||||
task.resolve_task(&id_base, &TaskContext::default())
|
||||
task.resolve_task(&id_base, Default::default(), &TaskContext::default())
|
||||
.unwrap_or_else(|| panic!("Failed to resolve task with name {task_name}")),
|
||||
);
|
||||
});
|
||||
|
|
|
@ -331,7 +331,7 @@ fn local_task_context_for_location(
|
|||
let worktree_id = location.buffer.read(cx).file().map(|f| f.worktree_id(cx));
|
||||
let worktree_abs_path = worktree_id
|
||||
.and_then(|worktree_id| worktree_store.read(cx).worktree_for_id(worktree_id, cx))
|
||||
.map(|worktree| worktree.read(cx).abs_path());
|
||||
.and_then(|worktree| worktree.read(cx).root_dir());
|
||||
|
||||
cx.spawn(|mut cx| async move {
|
||||
let worktree_abs_path = worktree_abs_path.clone();
|
||||
|
|
|
@ -50,13 +50,7 @@ impl Project {
|
|||
.and_then(|entry_id| self.worktree_for_entry(entry_id, cx))
|
||||
.into_iter()
|
||||
.chain(self.worktrees(cx))
|
||||
.find_map(|tree| {
|
||||
let worktree = tree.read(cx);
|
||||
worktree
|
||||
.root_entry()
|
||||
.filter(|entry| entry.is_dir())
|
||||
.map(|_| worktree.abs_path().clone())
|
||||
});
|
||||
.find_map(|tree| tree.read(cx).root_dir());
|
||||
worktree
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue