Add copilot crate
Refactor HTTP and github release downloading into util Lazily download / upgrade the copilot LSP from Zed Co-authored-by: Max <max@zed.dev> Co-Authored-By: Antonio <antonio@zed.dev>
This commit is contained in:
parent
35b2aceffb
commit
455cdc8b37
41 changed files with 435 additions and 265 deletions
|
@ -1,14 +1,17 @@
|
|||
use super::github::{latest_github_release, GitHubLspBinaryVersion};
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use async_trait::async_trait;
|
||||
use client::http::HttpClient;
|
||||
use futures::StreamExt;
|
||||
pub use language::*;
|
||||
use lsp::{CompletionItemKind, SymbolKind};
|
||||
use smol::fs::{self, File};
|
||||
use std::{any::Any, path::PathBuf, sync::Arc};
|
||||
use util::fs::remove_matching;
|
||||
use util::github::latest_github_release;
|
||||
use util::http::HttpClient;
|
||||
use util::ResultExt;
|
||||
|
||||
use super::github::GitHubLspBinaryVersion;
|
||||
|
||||
pub struct ElixirLspAdapter;
|
||||
|
||||
#[async_trait]
|
||||
|
@ -76,22 +79,7 @@ impl LspAdapter for ElixirLspAdapter {
|
|||
Err(anyhow!("failed to unzip clangd archive"))?;
|
||||
}
|
||||
|
||||
if let Some(mut entries) = fs::read_dir(&container_dir).await.log_err() {
|
||||
while let Some(entry) = entries.next().await {
|
||||
if let Some(entry) = entry.log_err() {
|
||||
let entry_path = entry.path();
|
||||
if entry_path.as_path() != version_dir {
|
||||
if let Ok(metadata) = fs::metadata(&entry_path).await {
|
||||
if metadata.is_file() {
|
||||
fs::remove_file(&entry_path).await.log_err();
|
||||
} else {
|
||||
fs::remove_dir_all(&entry_path).await.log_err();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
remove_matching(&container_dir, |entry| entry != version_dir).await;
|
||||
}
|
||||
|
||||
Ok(LanguageServerBinary {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue