Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

environments: Don't load shell environments in non-local worktrees (#23138)

Thorsten Ball91b36c31e882
diff --git a/crates/project/src/environment.rs b/crates/project/src/environment.rs
index a0c7d42502a..222cc298403 100644
--- a/crates/project/src/environment.rs
+++ b/crates/project/src/environment.rs
@@ -13,6 +13,7 @@ use crate::{
};
pub struct ProjectEnvironment {
+ worktree_store: Model<WorktreeStore>,
cli_environment: Option<HashMap<String, String>>,
environments: HashMap<WorktreeId, Shared<Task<Option<HashMap<String, String>>>>>,
environment_error_messages: HashMap<WorktreeId, EnvironmentErrorMessage>,
@@ -33,6 +34,7 @@ impl ProjectEnvironment {
.detach();
Self {
+ worktree_store: worktree_store.clone(),
cli_environment,
environments: Default::default(),
environment_error_messages: Default::default(),
@@ -102,6 +104,16 @@ impl ProjectEnvironment {
return Task::ready(None).shared();
};
+ if self
+ .worktree_store
+ .read(cx)
+ .worktree_for_id(worktree_id, cx)
+ .map(|w| !w.read(cx).is_local())
+ .unwrap_or(true)
+ {
+ return Task::ready(None).shared();
+ }
+
if let Some(task) = self.environments.get(&worktree_id) {
task.clone()
} else {