Fix bad global
This commit is contained in:
parent
455cdc8b37
commit
9a99eaee96
2 changed files with 6 additions and 2 deletions
|
@ -16,17 +16,18 @@ pub fn init(client: Arc<Client>, cx: &mut MutableAppContext) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
struct Copilot {
|
struct Copilot {
|
||||||
copilot_server: PathBuf,
|
copilot_server: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Copilot {
|
impl Copilot {
|
||||||
fn sign_in(http: Arc<dyn HttpClient>, cx: &mut MutableAppContext) {
|
fn sign_in(http: Arc<dyn HttpClient>, cx: &mut MutableAppContext) {
|
||||||
let copilot = cx.global::<Option<Arc<Copilot>>>().clone();
|
let maybe_copilot = cx.default_global::<Option<Arc<Copilot>>>().clone();
|
||||||
|
|
||||||
cx.spawn(|mut cx| async move {
|
cx.spawn(|mut cx| async move {
|
||||||
// Lazily download / initialize copilot LSP
|
// Lazily download / initialize copilot LSP
|
||||||
let copilot = if let Some(copilot) = copilot {
|
let copilot = if let Some(copilot) = maybe_copilot {
|
||||||
copilot
|
copilot
|
||||||
} else {
|
} else {
|
||||||
let copilot_server = get_lsp_binary(http).await?; // TODO: Make this error user visible
|
let copilot_server = get_lsp_binary(http).await?; // TODO: Make this error user visible
|
||||||
|
@ -38,6 +39,8 @@ impl Copilot {
|
||||||
new_copilot
|
new_copilot
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dbg!(copilot);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
|
@ -34,6 +34,7 @@ pub async fn latest_github_release(
|
||||||
.read_to_end(&mut body)
|
.read_to_end(&mut body)
|
||||||
.await
|
.await
|
||||||
.context("error reading latest release")?;
|
.context("error reading latest release")?;
|
||||||
|
|
||||||
let release: GithubRelease =
|
let release: GithubRelease =
|
||||||
serde_json::from_slice(body.as_slice()).context("error deserializing latest release")?;
|
serde_json::from_slice(body.as_slice()).context("error deserializing latest release")?;
|
||||||
Ok(release)
|
Ok(release)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue