which_key: Show task names for task::Spawn bindings (#64937)
## Summary
> I come from Neovim/AstroVim, and in AstroVim I really liked the help
popup that shows up as you press keys: each time, it tells you what the
next key does. I enabled the option in Zed and created my own tasks to
handle git, docker and my tests, but every time it shows `task: spawn`
instead of the text I configured.
>
> Instead of showing `task: spawn`, the menu now shows the task name,
i.e. its `label` in `tasks.json`. Everything else behaves as before.
>
> I use `ByName` to specifically target tasks and not affect other
behaviors.
Je viens de Neovim/AstroVim, et dans AstroVim j'aimais beaucoup l'encart
d'aide qui s'affiche au fur et à mesure des touches appuyées. À chaque
fois, il indique ce que fait la prochaine touche. J'ai activé l'option
dans Zed et j'ai créé mes propres tâches pour gérer git, docker et mes
tests, sauf qu'à chaque fois ça affiche `task: spawn` au lieu du texte
que j'ai configuré.
Au lieu d'afficher `task: spawn`, le menu affiche le nom de la tâche,
c'est-à-dire son `label` dans `tasks.json`. Pour tout le reste, le
comportement est le même qu'avant.
J'utilise `ByName` pour cibler spécifiquement les tâches et ne pas
impacter les autres comportements.
Closes #46348
<img width="345" height="263" alt="image"
src="https://github.com/user-attachments/assets/65258eb8-0759-4f33-ba85-f1ba80c2ffc0"
/>
<img width="672" height="590" alt="image"
src="https://github.com/user-attachments/assets/3085791b-e40a-4ec6-b9e3-fcf0d27021f8"
/>
## Testing
> I ran the crate tests with `cargo test -p which_key`: all 42 pass,
including 2 new ones, one for tasks spawned by name and one checking
that other actions keep the same label.
>
> I also built Zed locally on macOS and tested it with my own config. In
the `space g` menu, my tasks now show `lazygit` and `Open pull request`
instead of `task: spawn`. Before/after screenshots are above.
>
> To reproduce:
> 1. Add a task in `tasks.json`: `{ "label": "Say hello", "command":
"echo hello" }`
> 2. Bind it in `keymap.json`: `"space x": ["task::Spawn", {
"task_name": "Say hello" }]`
> 3. Enable which-key with `"which_key": { "enabled": true }`
> 4. Press `space` and wait: the menu shows `x Say hello` instead of `x
task: spawn`
J'ai lancé les tests du module avec `cargo test -p which_key` : les 42
tests passent, dont 2 nouveaux, un pour les tâches lancées par nom et un
pour vérifier que les autres actions gardent le même libellé.
J'ai aussi compilé Zed en local sur macOS et testé avec ma propre
config. Dans le menu `space g`, mes tâches affichent maintenant
`lazygit` et `Open pull request` au lieu de `task: spawn`. Les captures
avant/après sont au-dessus.
## Self-review
> I can't code in Rust, but I've been doing JavaScript for more than 15
years and I've already contributed to open source projects. I made this
PR with Claude and asked it to explain the syntax to me line by line.
The logic looks right to me, but some subtleties of the language may
escape me.
Je ne sais pas coder en Rust, mais je fais du JavaScript depuis plus de
15 ans et j'ai déjà contribué à des projets open source. J'ai fait la PR
avec Claude et je lui ai demandé de m'expliquer la syntaxe ligne par
ligne. La logique est bonne pour moi, mais il est possible que des
subtilités du langage m'échappent.
- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://github.com/zed-industries/zed/blob/main/docs/src/development/ui-checklist.md).
- [x] Tests cover the new or changed behavior.
Release Notes:
- Fixed which-key showing `task: spawn` instead of the task name for
bindings that spawn a task.
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
1dc8844439Yvonnick FRIN committed on 9/29/2026, 2:47:49 PM· committed by GitHubparentadfcaa1