diff --git a/crates/language/src/language.rs b/crates/language/src/language.rs index 332022a2bd..8bdf61f5f0 100644 --- a/crates/language/src/language.rs +++ b/crates/language/src/language.rs @@ -29,7 +29,7 @@ use async_trait::async_trait; use collections::{HashMap, HashSet, IndexSet}; use fs::Fs; use futures::Future; -use gpui::{App, AsyncApp, Entity, SharedString, Task}; +use gpui::{App, AsyncApp, Entity, SharedString}; pub use highlight_map::HighlightMap; use http_client::HttpClient; pub use language_registry::{ @@ -491,8 +491,8 @@ pub trait LspInstaller { &self, _: &Arc, _: &mut AsyncApp, - ) -> Option>> { - None + ) -> impl Future> { + async { Ok(()) } } fn check_if_version_installed( @@ -545,9 +545,7 @@ where container_dir: PathBuf, cx: &mut AsyncApp, ) -> Result { - if let Some(task) = self.will_fetch_server(delegate, cx) { - task.await?; - } + self.will_fetch_server(delegate, cx).await?; let name = self.name(); diff --git a/crates/languages/src/go.rs b/crates/languages/src/go.rs index 8257678c3f..5dffbe07d5 100644 --- a/crates/languages/src/go.rs +++ b/crates/languages/src/go.rs @@ -83,31 +83,28 @@ impl LspInstaller for GoLspAdapter { }) } - fn will_fetch_server( + async fn will_fetch_server( &self, delegate: &Arc, cx: &mut AsyncApp, - ) -> Option>> { + ) -> Result<()> { static DID_SHOW_NOTIFICATION: AtomicBool = AtomicBool::new(false); const NOTIFICATION_MESSAGE: &str = "Could not install the Go language server `gopls`, because `go` was not found."; - let delegate = delegate.clone(); - Some(cx.spawn(async move |cx| { - if delegate.which("go".as_ref()).await.is_none() { - if DID_SHOW_NOTIFICATION - .compare_exchange(false, true, SeqCst, SeqCst) - .is_ok() - { - cx.update(|cx| { - delegate.show_notification(NOTIFICATION_MESSAGE, cx); - })? - } - anyhow::bail!("cannot install gopls"); + if delegate.which("go".as_ref()).await.is_none() { + if DID_SHOW_NOTIFICATION + .compare_exchange(false, true, SeqCst, SeqCst) + .is_ok() + { + cx.update(|cx| { + delegate.show_notification(NOTIFICATION_MESSAGE, cx); + })? } - Ok(()) - })) + anyhow::bail!("cannot install gopls"); + } + Ok(()) } async fn fetch_server_binary(