Extensions registering tasks (#9572)
This PR also introduces built-in tasks for Rust and Elixir. Note that this is not a precedent for future PRs to include tasks for more languages; we simply want to find the rough edges with tasks & language integrations before proceeding to task contexts provided by extensions. As is, we'll load tasks for all loaded languages, so in order to get Elixir tasks, you have to open an Elixir buffer first. I think it sort of makes sense (though it's not ideal), as in the future where extensions do provide their own tasks.json, we'd like to limit the # of tasks surfaced to the user to make them as relevant to the project at hand as possible. Release Notes: - Added built-in tasks for Rust and Elixir files.
This commit is contained in:
parent
cb4f868815
commit
4dc61f7ccd
19 changed files with 416 additions and 169 deletions
|
@ -41,13 +41,26 @@ pub struct SpawnInTerminal {
|
|||
pub reveal: RevealStrategy,
|
||||
}
|
||||
|
||||
type VariableName = String;
|
||||
type VariableValue = String;
|
||||
|
||||
/// Container for predefined environment variables that describe state of Zed at the time the task was spawned.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct TaskVariables(pub HashMap<VariableName, VariableValue>);
|
||||
|
||||
impl FromIterator<(String, String)> for TaskVariables {
|
||||
fn from_iter<T: IntoIterator<Item = (String, String)>>(iter: T) -> Self {
|
||||
Self(HashMap::from_iter(iter))
|
||||
}
|
||||
}
|
||||
|
||||
/// Keeps track of the file associated with a task and context of tasks execution (i.e. current file or current function)
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct TaskContext {
|
||||
/// A path to a directory in which the task should be executed.
|
||||
pub cwd: Option<PathBuf>,
|
||||
/// Additional environment variables associated with a given task.
|
||||
pub env: HashMap<String, String>,
|
||||
pub task_variables: TaskVariables,
|
||||
}
|
||||
|
||||
/// Represents a short lived recipe of a task, whose main purpose
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue