Remove global workspace trust concept (#45129)
Follow-up of https://github.com/zed-industries/zed/pull/44887 Trims the worktree trust mechanism to the actual `worktree`s, so now "global", workspace-level things like `prettier`, `NodeRuntime`, `copilot` and global MCP servers are considered as "trusted" a priori. In the future, a separate mechanism for those will be considered and added. Release Notes: - N/A
This commit is contained in:
1 parent
1ca705dcfb
commit
997e7de3fd
17 files changed
+77
-799
No files matched your search
@@ -9,8 +9,6 @@ use serde::Deserialize;
|
||||
use smol::io::BufReader;
|
||||
use smol::{fs, lock::Mutex};
|
||||
use std::fmt::Display;
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::{
|
||||
env::{self, consts},
|
||||
ffi::OsString,
|
||||
@@ -48,7 +46,6 @@ struct NodeRuntimeState {
|
||||
last_options: Option<NodeBinaryOptions>,
|
||||
options: watch::Receiver<Option<NodeBinaryOptions>>,
|
||||
shell_env_loaded: Shared<oneshot::Receiver<()>>,
|
||||
trust_task: Option<Pin<Box<dyn Future<Output = ()> + Send>>>,
|
||||
}
|
||||
|
||||
impl NodeRuntime {
|
||||
@@ -56,11 +53,9 @@ impl NodeRuntime {
|
||||
http: Arc<dyn HttpClient>,
|
||||
shell_env_loaded: Option<oneshot::Receiver<()>>,
|
||||
options: watch::Receiver<Option<NodeBinaryOptions>>,
|
||||
trust_task: Option<Pin<Box<dyn Future<Output = ()> + Send>>>,
|
||||
) -> Self {
|
||||
NodeRuntime(Arc::new(Mutex::new(NodeRuntimeState {
|
||||
http,
|
||||
trust_task,
|
||||
instance: None,
|
||||
last_options: None,
|
||||
options,
|
||||
@@ -75,15 +70,11 @@ impl NodeRuntime {
|
||||
last_options: None,
|
||||
options: watch::channel(Some(NodeBinaryOptions::default())).1,
|
||||
shell_env_loaded: oneshot::channel().1.shared(),
|
||||
trust_task: None,
|
||||
})))
|
||||
}
|
||||
|
||||
async fn instance(&self) -> Box<dyn NodeRuntimeTrait> {
|
||||
let mut state = self.0.lock().await;
|
||||
if let Some(trust_task) = state.trust_task.take() {
|
||||
trust_task.await;
|
||||
}
|
||||
|
||||
let options = loop {
|
||||
if let Some(options) = state.options.borrow().as_ref() {
|
||||
|
||||
Reference in new issue
Block a user