Move servers back from the background thread (#44696)
Kirill Bulatov
created 2 weeks ago
Partial revert of https://github.com/zed-industries/zed/pull/44631
With this and `sccache` enabled, I get
<img width="3456" height="1096" alt="image"
src="https://github.com/user-attachments/assets/937760fb-8b53-49f8-ae63-4df1d31b292b"
/>
and r-a infinitely hangs waiting on this.
Release Notes:
- N/A
Change summary
crates/copilot/src/copilot.rs | 3 +--
crates/lsp/src/lsp.rs | 32 ++++++++++++++------------------
crates/prettier/src/prettier.rs | 1 -
crates/project/src/lsp_store.rs | 1 -
4 files changed, 15 insertions(+), 22 deletions(-)
Detailed changes
@@ -516,8 +516,7 @@ impl Copilot {
None,
Default::default(),
cx,
- )
- .await?;
+ )?;
server
.on_notification::<StatusNotification, _>(|_, _| { /* Silence the notification */ })
@@ -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();
@@ -320,7 +320,6 @@ impl Prettier {
Default::default(),
&mut cx,
)
- .await
.context("prettier server creation")?;
let server = cx
@@ -425,7 +425,6 @@ impl LocalLspStore {
Some(pending_workspace_folders),
cx,
)
- .await
}
});