Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Check for user installed clangd (#9605)
Ezekiel Warrenb6201a34b9ce
diff --git a/crates/languages/src/c.rs b/crates/languages/src/c.rsindex 7c4d992c236..d135ca5e287 100644--- a/crates/languages/src/c.rs+++ b/crates/languages/src/c.rs@@ -1,6 +1,7 @@use anyhow::{anyhow, bail, Context, Result};use async_trait::async_trait;use futures::StreamExt;+use gpui::AsyncAppContext;pub use language::*;use lsp::LanguageServerBinary;use smol::fs::{self, File};@@ -29,6 +30,7 @@ impl super::LspAdapter for CLspAdapter {let os_suffix = match consts::OS {"macos" => "mac","linux" => "linux",+ "windows" => "windows",other => bail!("Running on unsupported os: {other}"),};let asset_name = format!("clangd-{}-{}.zip", os_suffix, release.tag_name);@@ -44,6 +46,20 @@ impl super::LspAdapter for CLspAdapter {Ok(Box::new(version) as Box<_>)}+ async fn check_if_user_installed(+ &self,+ delegate: &dyn LspAdapterDelegate,+ _: &AsyncAppContext,+ ) -> Option<LanguageServerBinary> {+ let env = delegate.shell_env().await;+ let path = delegate.which("clangd".as_ref()).await?;+ Some(LanguageServerBinary {+ path,+ arguments: vec![],+ env: Some(env),+ })+ }+async fn fetch_server_binary(&self,version: Box<dyn 'static + Send + Any>,