Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Do not allow [re]running ssh tasks when not connected to the server (#19306)
Kirill Bulatov56f69be2e772
diff --git a/crates/tasks_ui/src/modal.rs b/crates/tasks_ui/src/modal.rsindex f11f58e010c..c18a0e6ba62 100644--- a/crates/tasks_ui/src/modal.rs+++ b/crates/tasks_ui/src/modal.rs@@ -384,13 +384,6 @@ impl PickerDelegate for TasksModalDelegate {.start_slot::<Icon>(icon).end_slot::<AnyElement>(history_run_icon).spacing(ListItemSpacing::Sparse)- // .map(|this| {- // if Some(ix) <= self.divider_index {- // this.start_slot(Icon::new(IconName::HistoryRerun).size(IconSize::Small))- // } else {- // this.start_slot(v_flex().flex_none().size(IconSize::Small.rems()))- // }- // }).when_some(tooltip_label, |list_item, item_label| {list_item.tooltip(move |_| item_label.clone())})diff --git a/crates/workspace/src/tasks.rs b/crates/workspace/src/tasks.rsindex 377875ee1b2..c2b6e51acd2 100644--- a/crates/workspace/src/tasks.rs+++ b/crates/workspace/src/tasks.rs@@ -1,4 +1,5 @@use project::TaskSourceKind;+use remote::ConnectionState;use task::{ResolvedTask, TaskContext, TaskTemplate};use ui::ViewContext;@@ -12,6 +13,19 @@ pub fn schedule_task(omit_history: bool,cx: &mut ViewContext<'_, Workspace>,) {+ match workspace.project.read(cx).ssh_connection_state(cx) {+ None | Some(ConnectionState::Connected) => {}+ Some(+ ConnectionState::Connecting+ | ConnectionState::Disconnected+ | ConnectionState::HeartbeatMissed+ | ConnectionState::Reconnecting,+ ) => {+ log::warn!("Cannot schedule tasks when disconnected from a remote host");+ return;+ }+ }+if let Some(spawn_in_terminal) =task_to_resolve.resolve_task(&task_source_kind.to_id_base(), task_cx){