Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Move servers back from the background thread (#44696)
Kirill Bulatov1afe29422bb1
diff --git a/crates/copilot/src/copilot.rs b/crates/copilot/src/copilot.rsindex b51f6925513..4e652090607 100644--- a/crates/copilot/src/copilot.rs+++ b/crates/copilot/src/copilot.rs@@ -516,8 +516,7 @@ impl Copilot {None,Default::default(),cx,- )- .await?;+ )?;server.on_notification::<StatusNotification, _>(|_, _| { /* Silence the notification */ })diff --git a/crates/lsp/src/lsp.rs b/crates/lsp/src/lsp.rsindex ea3b0b09d6a..9ff6e245c49 100644--- a/crates/lsp/src/lsp.rs+++ b/crates/lsp/src/lsp.rs@@ -314,7 +314,7 @@ pub struct AdapterServerCapabilities {impl LanguageServer {/// Starts a language server process.- pub async fn new(+ pub fn new(stderr_capture: Arc<Mutex<Option<String>>>,server_id: LanguageServerId,server_name: LanguageServerName,@@ -338,23 +338,19 @@ impl LanguageServer {working_dir,&binary.arguments);- let mut server = cx- .background_executor()- .await_on_background(async {- let mut command = util::command::new_smol_command(&binary.path);- command- .current_dir(working_dir)- .args(&binary.arguments)- .envs(binary.env.clone().unwrap_or_default())- .stdin(Stdio::piped())- .stdout(Stdio::piped())- .stderr(Stdio::piped())- .kill_on_drop(true);- command- .spawn()- .with_context(|| format!("failed to spawn command {command:?}",))- })- .await?;+ let mut command = util::command::new_smol_command(&binary.path);+ command+ .current_dir(working_dir)+ .args(&binary.arguments)+ .envs(binary.env.clone().unwrap_or_default())+ .stdin(Stdio::piped())+ .stdout(Stdio::piped())+ .stderr(Stdio::piped())+ .kill_on_drop(true);++ let mut server = command+ .spawn()+ .with_context(|| format!("failed to spawn command {command:?}",))?;let stdin = server.stdin.take().unwrap();let stdout = server.stdout.take().unwrap();diff --git a/crates/prettier/src/prettier.rs b/crates/prettier/src/prettier.rsindex 247d0a2656f..bc4ce609a1f 100644--- a/crates/prettier/src/prettier.rs+++ b/crates/prettier/src/prettier.rs@@ -320,7 +320,6 @@ impl Prettier {Default::default(),&mut cx,)- .await.context("prettier server creation")?;let server = cxdiff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rsindex 9514ea03eff..a8c639fe593 100644--- a/crates/project/src/lsp_store.rs+++ b/crates/project/src/lsp_store.rs@@ -425,7 +425,6 @@ impl LocalLspStore {Some(pending_workspace_folders),cx,)- .await}});