Properly pass nested script arguments for tasks (#10776)

Closes
https://github.com/zed-industries/zed/discussions/10732#discussion-6524347
introduced by https://github.com/zed-industries/zed/pull/10548 while
keeping both Python and Bash run selection capabilities.

Also replaced redundant `SpawnTask` struct with `SpawnInTerminal` that
has identical fields.

Release Notes:

- Fixed incorrect task escaping of nested script arguments

---------

Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
This commit is contained in:
Kirill Bulatov 2024-04-19 16:24:35 +03:00 committed by GitHub
parent 9247da77a3
commit 13c17267b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 55 additions and 85 deletions

View file

@ -307,16 +307,16 @@ impl PickerDelegate for TasksModalDelegate {
let display_label = resolved_task.display_label();
let mut tooltip_label_text = if display_label != &template.label {
template.label.clone()
resolved_task.resolved_label.clone()
} else {
String::new()
};
if let Some(resolved_command) = resolved_task.resolved_command() {
if display_label != resolved_command {
if let Some(resolved) = resolved_task.resolved.as_ref() {
if display_label != resolved.command_label {
if !tooltip_label_text.trim().is_empty() {
tooltip_label_text.push('\n');
}
tooltip_label_text.push_str(&resolved_command);
tooltip_label_text.push_str(&resolved.command_label);
}
}
let tooltip_label = if tooltip_label_text.trim().is_empty() {
@ -392,7 +392,7 @@ impl PickerDelegate for TasksModalDelegate {
let task_index = self.matches.get(self.selected_index())?.candidate_id;
let tasks = self.candidates.as_ref()?;
let (_, task) = tasks.get(task_index)?;
task.resolved_command()
Some(task.resolved.as_ref()?.command_label.clone())
}
fn confirm_input(&mut self, omit_history_entry: bool, cx: &mut ViewContext<Picker<Self>>) {