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:
Mikayla Maki
2024-12-13 19:39:46 -08:00
committed by GitHub
parent 85c3aec6e7
commit 4f96706161
18 changed files with 263 additions and 106 deletions
+24
View File
@@ -155,6 +155,30 @@ You can define your own keybindings for your tasks via additional argument to `t
}
```
Note that these tasks can also have a 'target' specified to control where the spawned task should show up.
This could be useful for launching a terminal application that you want to use in the center area:
```json
// In tasks.json
{
"label": "start lazygit",
"command": "lazygit -p $ZED_WORKTREE_ROOT"
}
```
```json
// In keymap.json
{
"context": "Workspace",
"bindings": {
"alt-g": [
"task::Spawn",
{ "task_name": "start lazygit", "target": "center" }
]
}
}
```
## Binding runnable tags to task templates
Zed supports overriding default action for inline runnable indicators via workspace-local and global `tasks.json` file with the following precedence hierarchy: