task: Allow Rerun action to override properties of task being reran (#10468)
For example: ``` "alt-t": [ "task::Rerun", { "reevaluate_context": true, "allow_concurrent_runs": true } ], ``` Overriding `allow_concurrent_runs` to `true` by itself should terminate current instance of the task, if there's any. This PR also fixes task deduplication in terminal panel to use expanded label and not the id, which depends on task context. It kinda aligns with how task rerun worked prior to #10341 . That's omitted in the release notes though, as it's not in Preview yet. Release Notes: - `Task::Rerun` action can now override `allow_concurrent_runs` and `use_new_terminal` properties of the task that is being reran.
This commit is contained in:
parent
6e1ba7e936
commit
298e9c9387
4 changed files with 31 additions and 7 deletions
|
@ -334,7 +334,7 @@ impl TerminalPanel {
|
|||
return;
|
||||
}
|
||||
|
||||
let terminals_for_task = self.terminals_for_task(&spawn_in_terminal.id, cx);
|
||||
let terminals_for_task = self.terminals_for_task(&spawn_in_terminal.label, cx);
|
||||
if terminals_for_task.is_empty() {
|
||||
self.spawn_in_new_terminal(spawn_task, working_directory, cx);
|
||||
return;
|
||||
|
@ -435,7 +435,7 @@ impl TerminalPanel {
|
|||
|
||||
fn terminals_for_task(
|
||||
&self,
|
||||
id: &TaskId,
|
||||
label: &str,
|
||||
cx: &mut AppContext,
|
||||
) -> Vec<(usize, View<TerminalView>)> {
|
||||
self.pane
|
||||
|
@ -445,7 +445,7 @@ impl TerminalPanel {
|
|||
.filter_map(|(index, item)| Some((index, item.act_as::<TerminalView>(cx)?)))
|
||||
.filter_map(|(index, terminal_view)| {
|
||||
let task_state = terminal_view.read(cx).terminal().read(cx).task()?;
|
||||
if &task_state.id == id {
|
||||
if &task_state.label == label {
|
||||
Some((index, terminal_view))
|
||||
} else {
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue