Detailed changes
@@ -174,6 +174,8 @@ impl Project {
command_label: spawn_task.command_label,
hide: spawn_task.hide,
status: TaskStatus::Running,
+ show_summary: spawn_task.show_summary,
+ show_command: spawn_task.show_command,
completion_rx,
});
@@ -51,6 +51,10 @@ pub struct SpawnInTerminal {
pub hide: HideStrategy,
/// Which shell to use when spawning the task.
pub shell: Shell,
+ /// Whether to show the task summary line in the task output (sucess/failure).
+ pub show_summary: bool,
+ /// Whether to show the command line in the task output.
+ pub show_command: bool,
}
/// A final form of the [`TaskTemplate`], that got resolved with a particualar [`TaskContext`] and now is ready to spawn the actual task.
@@ -1,4 +1,5 @@
use std::path::PathBuf;
+use util::serde::default_true;
use anyhow::{bail, Context};
use collections::{HashMap, HashSet};
@@ -57,6 +58,12 @@ pub struct TaskTemplate {
/// Which shell to use when spawning the task.
#[serde(default)]
pub shell: Shell,
+ /// Whether to show the task line in the task output.
+ #[serde(default = "default_true")]
+ pub show_summary: bool,
+ /// Whether to show the command line in the task output.
+ #[serde(default = "default_true")]
+ pub show_command: bool,
}
/// What to do with the terminal pane and tab, after the command was started.
@@ -230,6 +237,8 @@ impl TaskTemplate {
reveal: self.reveal,
hide: self.hide,
shell: self.shell.clone(),
+ show_summary: self.show_summary,
+ show_command: self.show_command,
}),
})
}
@@ -639,6 +639,8 @@ pub struct TaskState {
pub status: TaskStatus,
pub completion_rx: Receiver<()>,
pub hide: HideStrategy,
+ pub show_summary: bool,
+ pub show_command: bool,
}
/// A status of the current terminal tab's task.
@@ -1760,11 +1762,22 @@ impl Terminal {
};
let (finished_successfully, task_line, command_line) = task_summary(task, error_code);
- // SAFETY: the invocation happens on non `TaskStatus::Running` tasks, once,
- // after either `AlacTermEvent::Exit` or `AlacTermEvent::ChildExit` events that are spawned
- // when Zed task finishes and no more output is made.
- // After the task summary is output once, no more text is appended to the terminal.
- unsafe { append_text_to_term(&mut self.term.lock(), &[&task_line, &command_line]) };
+ let mut lines_to_show = Vec::new();
+ if task.show_summary {
+ lines_to_show.push(task_line.as_str());
+ }
+ if task.show_command {
+ lines_to_show.push(command_line.as_str());
+ }
+
+ if !lines_to_show.is_empty() {
+ // SAFETY: the invocation happens on non `TaskStatus::Running` tasks, once,
+ // after either `AlacTermEvent::Exit` or `AlacTermEvent::ChildExit` events that are spawned
+ // when Zed task finishes and no more output is made.
+ // After the task summary is output once, no more text is appended to the terminal.
+ unsafe { append_text_to_term(&mut self.term.lock(), &lines_to_show) };
+ }
+
match task.hide {
HideStrategy::Never => {}
HideStrategy::Always => {
@@ -41,7 +41,11 @@ Zed supports ways to spawn (and rerun) commands using its integrated terminal to
// "args": ["--login"]
// }
// }
- "shell": "system"
+ "shell": "system",
+ // Whether to show the task line in the output of the spawned task, defaults to `true`.
+ "show_summary": true,
+ // Whether to show the command line in the output of the spawned task, defaults to `true`.
+ "show_output": true
}
]
```