mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-07 02:57:34 +00:00
Check for user installed clangd (#9605)
Release Notes: - Improved C/C++ support using user installed clangd when available
This commit is contained in:
parent
85fdcef564
commit
b6201a34b9
1 changed files with 16 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
use anyhow::{anyhow, bail, Context, Result};
|
use anyhow::{anyhow, bail, Context, Result};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
|
use gpui::AsyncAppContext;
|
||||||
pub use language::*;
|
pub use language::*;
|
||||||
use lsp::LanguageServerBinary;
|
use lsp::LanguageServerBinary;
|
||||||
use smol::fs::{self, File};
|
use smol::fs::{self, File};
|
||||||
|
@ -29,6 +30,7 @@ impl super::LspAdapter for CLspAdapter {
|
||||||
let os_suffix = match consts::OS {
|
let os_suffix = match consts::OS {
|
||||||
"macos" => "mac",
|
"macos" => "mac",
|
||||||
"linux" => "linux",
|
"linux" => "linux",
|
||||||
|
"windows" => "windows",
|
||||||
other => bail!("Running on unsupported os: {other}"),
|
other => bail!("Running on unsupported os: {other}"),
|
||||||
};
|
};
|
||||||
let asset_name = format!("clangd-{}-{}.zip", os_suffix, release.tag_name);
|
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<_>)
|
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(
|
async fn fetch_server_binary(
|
||||||
&self,
|
&self,
|
||||||
version: Box<dyn 'static + Send + Any>,
|
version: Box<dyn 'static + Send + Any>,
|
||||||
|
|
Loading…
Reference in a new issue