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.

project: Create LSP file watcher on the background (#60530)

Lukas Wirthf360136f1993
diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs
index 666ba714f97..96f02fcb778 100644
--- a/crates/project/src/lsp_store.rs
+++ b/crates/project/src/lsp_store.rs
@@ -14409,7 +14409,12 @@ impl LanguageServerWatchedPaths {
cx.spawn({
async move |_, cx| {
maybe!(async move {
- let mut push_updates = fs.watch(&abs_path, LSP_ABS_PATH_OBSERVE).await;
+ let mut push_updates = cx
+ .background_spawn({
+ let abs_path = abs_path.clone();
+ async move { fs.watch(&abs_path, LSP_ABS_PATH_OBSERVE).await }
+ })
+ .await;
while let Some(update) = push_updates.0.next().await {
let action = lsp_store
.update(cx, |this, _| {
diff --git a/crates/session/src/session.rs b/crates/session/src/session.rs
index 76f2398b382..04109ce1b2f 100644
--- a/crates/session/src/session.rs
+++ b/crates/session/src/session.rs
@@ -70,8 +70,7 @@ impl AppSession {
pub fn new(session: Session, cx: &Context<Self>) -> Self {
let _subscriptions = vec![cx.on_app_quit(Self::app_will_quit)];
- #[cfg(not(any(test, feature = "test-support")))]
- let _serialization_task = {
+ let _serialization_task = if cfg!(not(any(test, feature = "test-support"))) {
let db = KeyValueStore::global(cx);
cx.spawn(async move |_, cx| {
// Disabled in tests: the infinite loop bypasses "parking forbidden" checks,
@@ -92,11 +91,10 @@ impl AppSession {
}
}
})
+ } else {
+ Task::ready(())
};
- #[cfg(any(test, feature = "test-support"))]
- let _serialization_task = Task::ready(());
-
Self {
session,
_subscriptions,