Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
chore: Move a few more tasks into background_spawn (#35374)
Piotr Osiewicz296bb66b653a
diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rsindex dd4d0a7f40c..af3df72c293 100644--- a/crates/project/src/lsp_store.rs+++ b/crates/project/src/lsp_store.rs@@ -4911,7 +4911,7 @@ impl LspStore {language_server_id: server_id.0 as u64,hint: Some(InlayHints::project_to_proto_hint(hint.clone())),};- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {let response = upstream_client.request(request).await@@ -5125,7 +5125,7 @@ impl LspStore {trigger,version: serialize_version(&buffer.read(cx).version()),};- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {client.request(request).await?@@ -5284,7 +5284,7 @@ impl LspStore {GetDefinitions { position },cx,);- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {Ok(definitions_task.await.into_iter()@@ -5357,7 +5357,7 @@ impl LspStore {GetDeclarations { position },cx,);- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {Ok(declarations_task.await.into_iter()@@ -5430,7 +5430,7 @@ impl LspStore {GetTypeDefinitions { position },cx,);- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {Ok(type_definitions_task.await.into_iter()@@ -5503,7 +5503,7 @@ impl LspStore {GetImplementations { position },cx,);- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {Ok(implementations_task.await.into_iter()@@ -5576,7 +5576,7 @@ impl LspStore {GetReferences { position },cx,);- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {Ok(references_task.await.into_iter()@@ -5660,7 +5660,7 @@ impl LspStore {},cx,);- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {Ok(all_actions_task.await.into_iter()@@ -6854,7 +6854,7 @@ impl LspStore {} else {let document_colors_task =self.request_multiple_lsp_locally(buffer, None::<usize>, GetDocumentColor, cx);- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {Ok(document_colors_task.await.into_iter()@@ -6933,7 +6933,7 @@ impl LspStore {GetSignatureHelp { position },cx,);- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {all_actions_task.await.into_iter()@@ -7010,7 +7010,7 @@ impl LspStore {GetHover { position },cx,);- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {all_actions_task.await.into_iter()@@ -8013,7 +8013,7 @@ impl LspStore {}).collect::<FuturesUnordered<_>>();- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {let mut responses = Vec::with_capacity(response_results.len());while let Some((server_id, response_result)) = response_results.next().await {if let Some(response) = response_result.log_err() {diff --git a/crates/project/src/project.rs b/crates/project/src/project.rsindex 6b943216b3d..13587b43e7e 100644--- a/crates/project/src/project.rs+++ b/crates/project/src/project.rs@@ -3372,7 +3372,7 @@ impl Project {let task = self.lsp_store.update(cx, |lsp_store, cx| {lsp_store.definitions(buffer, position, cx)});- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {let result = task.await;drop(guard);result@@ -3390,7 +3390,7 @@ impl Project {let task = self.lsp_store.update(cx, |lsp_store, cx| {lsp_store.declarations(buffer, position, cx)});- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {let result = task.await;drop(guard);result@@ -3408,7 +3408,7 @@ impl Project {let task = self.lsp_store.update(cx, |lsp_store, cx| {lsp_store.type_definitions(buffer, position, cx)});- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {let result = task.await;drop(guard);result@@ -3426,7 +3426,7 @@ impl Project {let task = self.lsp_store.update(cx, |lsp_store, cx| {lsp_store.implementations(buffer, position, cx)});- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {let result = task.await;drop(guard);result@@ -3444,7 +3444,7 @@ impl Project {let task = self.lsp_store.update(cx, |lsp_store, cx| {lsp_store.references(buffer, position, cx)});- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {let result = task.await;drop(guard);result@@ -3996,7 +3996,7 @@ impl Project {let task = self.lsp_store.update(cx, |lsp_store, cx| {lsp_store.request_lsp(buffer_handle, server, request, cx)});- cx.spawn(async move |_, _| {+ cx.background_spawn(async move {let result = task.await;drop(guard);result