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:
Mikayla Maki 2023-03-22 19:22:08 -07:00
parent 35b2aceffb
commit 455cdc8b37
41 changed files with 435 additions and 265 deletions

View file

@ -1,17 +1,15 @@
use super::node_runtime::NodeRuntime;
use anyhow::{anyhow, Context, Result};
use async_trait::async_trait;
use client::http::HttpClient;
use futures::StreamExt;
use language::{LanguageServerBinary, LanguageServerName, LspAdapter};
use serde_json::json;
use smol::fs;
use std::{
any::Any,
ffi::OsString,
path::{Path, PathBuf},
sync::Arc,
};
use std::ffi::OsString;
use std::path::Path;
use std::{any::Any, path::PathBuf, sync::Arc};
use util::fs::remove_matching;
use util::http::HttpClient;
use util::ResultExt;
fn server_binary_arguments(server_path: &Path) -> Vec<OsString> {
@ -69,16 +67,7 @@ impl LspAdapter for HtmlLspAdapter {
)
.await?;
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 {
fs::remove_dir_all(&entry_path).await.log_err();
}
}
}
}
remove_matching(container_dir.as_path(), |entry| entry != version_dir).await;
}
Ok(LanguageServerBinary {