tasks: Add spawn option by tag (#25650)

Closes #19497
Fixed conflicts from https://github.com/zed-industries/zed/pull/19498
Added tags to tasks selector

Release Notes:

- Added ability to spawn tasks by tag with key bindings
- Added tags to tasks selector


https://github.com/user-attachments/assets/0eefea21-ec4e-407c-9d4f-2a0a4a0f74df

---------

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
This commit is contained in:
Artem Evsikov 2025-04-04 17:20:09 +03:00 committed by GitHub
parent 80441f675b
commit 2f5a4f7e80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 174 additions and 33 deletions

View file

@ -1,16 +1,16 @@
use std::path::PathBuf;
use util::serde::default_true;
use anyhow::{Context, bail};
use collections::{HashMap, HashSet};
use schemars::{JsonSchema, r#gen::SchemaSettings};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use std::path::PathBuf;
use util::serde::default_true;
use util::{ResultExt, truncate_and_remove_front};
use crate::{
AttachConfig, ResolvedTask, RevealTarget, Shell, SpawnInTerminal, TCPHost, TaskContext, TaskId,
VariableName, ZED_VARIABLE_NAME_PREFIX,
serde_helpers::{non_empty_string_vec, non_empty_string_vec_json_schema},
};
/// A template definition of a Zed task to run.
@ -61,8 +61,10 @@ pub struct TaskTemplate {
/// If this task should start a debugger or not
#[serde(default, skip)]
pub task_type: TaskType,
/// Represents the tags which this template attaches to. Adding this removes this task from other UI.
#[serde(default)]
/// Represents the tags which this template attaches to.
/// Adding this removes this task from other UI and gives you ability to run it by tag.
#[serde(default, deserialize_with = "non_empty_string_vec")]
#[schemars(schema_with = "non_empty_string_vec_json_schema")]
pub tags: Vec<String>,
/// Which shell to use when spawning the task.
#[serde(default)]