tasks: Add editor: Spawn Nearest Task action (#19901)

This spawns the runnable task that that's closest to the cursor.

One thing missing right now is that it doesn't find tasks that are
attached to non-outline symbols, such as subtests in Go.

Release Notes:

- Added a new reveal option for tasks: `"no_focus"`. If used, the tasks
terminal panel will be opened and shown, but not focused.
- Added a new `editor: spawn nearest task` action that spawns the task
with a run indicator icon nearest to the cursor. It can be configured to
also use a `reveal` strategy. Example:
```json
{
  "context": "EmptyPane || SharedScreen || vim_mode == normal",
  "bindings": {
    ", r t": ["editor::SpawnNearestTask", { "reveal": "no_focus" }],
  }
}
```


Demo:



https://github.com/user-attachments/assets/0d1818f0-7ae4-4200-8c3e-0ed47550c298

---------

Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
Thorsten Ball 2024-10-31 14:25:57 +01:00 committed by GitHub
parent 633b665379
commit 293e080f03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 259 additions and 38 deletions

View file

@ -66,6 +66,8 @@ pub enum RevealStrategy {
/// Always show the terminal pane, add and focus the corresponding task's tab in it.
#[default]
Always,
/// Always show the terminal pane, add the task's tab in it, but don't focus it.
NoFocus,
/// Do not change terminal pane focus, but still add/reuse the task's tab there.
Never,
}