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
|
@ -90,6 +90,14 @@ pub struct OpenRecent {
|
|||
gpui::impl_actions!(projects, [OpenRecent]);
|
||||
gpui::actions!(projects, [OpenRemote]);
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Copy, Deserialize, Default, Debug)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum TaskSpawnTarget {
|
||||
Center,
|
||||
#[default]
|
||||
Dock,
|
||||
}
|
||||
|
||||
/// Spawn a task with name or open tasks modal
|
||||
#[derive(PartialEq, Clone, Deserialize, Default)]
|
||||
pub struct Spawn {
|
||||
|
@ -98,11 +106,18 @@ pub struct Spawn {
|
|||
/// If it is not set, a modal with a list of available tasks is opened instead.
|
||||
/// Defaults to None.
|
||||
pub task_name: Option<String>,
|
||||
/// Which part of the UI the task should be spawned in.
|
||||
/// Defaults to Dock.
|
||||
#[serde(default)]
|
||||
pub target: Option<TaskSpawnTarget>,
|
||||
}
|
||||
|
||||
impl Spawn {
|
||||
pub fn modal() -> Self {
|
||||
Self { task_name: None }
|
||||
Self {
|
||||
task_name: None,
|
||||
target: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue