Document two task rerun modes better (#37996)

Part of https://github.com/zed-industries/zed/issues/37720

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov
2025-09-11 14:41:02 +00:00
committed by GitHub
parent f6b6d4a9fe
commit a066794e8d
4 changed files with 24 additions and 3 deletions
+3 -1
View File
@@ -649,7 +649,9 @@
"ctrl-k shift-up": "workspace::SwapPaneUp",
"ctrl-k shift-down": "workspace::SwapPaneDown",
"ctrl-shift-x": "zed::Extensions",
"ctrl-shift-r": "task::Rerun",
// All task parameters are captured and unchanged between reruns by default.
// Use the `"reevaluate_context"` parameter to control this.
"ctrl-shift-r": ["task::Rerun", { "reevaluate_context": false }],
"ctrl-alt-r": "task::Rerun",
"alt-t": "task::Rerun",
"alt-shift-t": "task::Spawn",
+3 -1
View File
@@ -724,7 +724,9 @@
"bindings": {
"cmd-n": "workspace::NewFile",
"cmd-shift-r": "task::Spawn",
"cmd-alt-r": "task::Rerun",
// All task parameters are captured and unchanged between reruns by default.
// Use the `"reevaluate_context"` parameter to control this.
"cmd-alt-r": ["task::Rerun", { "reevaluate_context": false }],
"ctrl-alt-shift-r": ["task::Spawn", { "reveal_target": "center" }]
// also possible to spawn tasks by name:
// "foo-bar": ["task::Spawn", { "task_name": "MyTask", "reveal_target": "dock" }]
+3 -1
View File
@@ -642,7 +642,9 @@
"ctrl-k shift-up": "workspace::SwapPaneUp",
"ctrl-k shift-down": "workspace::SwapPaneDown",
"ctrl-shift-x": "zed::Extensions",
"ctrl-shift-r": "task::Rerun",
// All task parameters are captured and unchanged between reruns by default.
// Use the `"reevaluate_context"` parameter to control this.
"ctrl-shift-r": ["task::Rerun", { "reevaluate_context": false }],
"alt-t": "task::Rerun",
"shift-alt-t": "task::Spawn",
"shift-alt-r": ["task::Spawn", { "reveal_target": "center" }],
+15
View File
@@ -145,6 +145,21 @@ You can also adjust the currently selected task in a modal (`tab` is the default
You can use the `cmd` modifier when spawning a task via a modal; tasks spawned this way will not have their usage count increased (thus, they will not be respawned with `task: rerun` and they won't have a high rank in the task modal).
The intended use of ephemeral tasks is to stay in the flow with continuous `task: rerun` usage.
### More task rerun control
By default, tasks capture their variables into a context once, and this "resolved task" is being rerun always.
This can be controlled with the `"reevaluate_context"` argument to the task: setting it to `true` will force the task to be reevaluated before each run.
```json
{
"context": "Workspace",
"bindings": {
"alt-t": ["task::Rerun", { "reevaluate_context": true }]
}
}
```
## Custom keybindings for tasks
You can define your own keybindings for your tasks via an additional argument to `task::Spawn`. If you wanted to bind the aforementioned `echo current file's path` task to `alt-g`, you would add the following snippet in your [`keymap.json`](./key-bindings.md) file: