disable auto-download of language servers
This commit is contained in:
parent
b9611cdaaa
commit
100e6defed
@ -353,7 +353,10 @@ pub trait LspAdapter: 'static + Send + Sync {
|
|||||||
// because we don't want to download and overwrite our global one
|
// because we don't want to download and overwrite our global one
|
||||||
// for each worktree we might have open.
|
// for each worktree we might have open.
|
||||||
if binary_options.allow_path_lookup {
|
if binary_options.allow_path_lookup {
|
||||||
if let Some(binary) = self.check_if_user_installed(delegate.as_ref(), toolchains, cx).await {
|
if let Some(binary) = self
|
||||||
|
.check_if_user_installed(delegate.as_ref(), toolchains, cx)
|
||||||
|
.await
|
||||||
|
{
|
||||||
log::info!(
|
log::info!(
|
||||||
"found user-installed language server for {}. path: {:?}, arguments: {:?}",
|
"found user-installed language server for {}. path: {:?}, arguments: {:?}",
|
||||||
self.name().0,
|
self.name().0,
|
||||||
@ -364,47 +367,10 @@ pub trait LspAdapter: 'static + Send + Sync {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !binary_options.allow_binary_download {
|
return Err(anyhow!(
|
||||||
return Err(anyhow!("downloading language servers disabled"));
|
"Fred does not auto-download language servers. Please provide your own trusted copy of '{}'",
|
||||||
}
|
self.name().0
|
||||||
|
));
|
||||||
if let Some(cached_binary) = cached_binary.as_ref() {
|
|
||||||
return Ok(cached_binary.clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
let Some(container_dir) = delegate.language_server_download_dir(&self.name()).await else {
|
|
||||||
anyhow::bail!("no language server download dir defined")
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut binary = try_fetch_server_binary(self.as_ref(), &delegate, container_dir.to_path_buf(), cx).await;
|
|
||||||
|
|
||||||
if let Err(error) = binary.as_ref() {
|
|
||||||
if let Some(prev_downloaded_binary) = self
|
|
||||||
.cached_server_binary(container_dir.to_path_buf(), delegate.as_ref())
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
log::info!(
|
|
||||||
"failed to fetch newest version of language server {:?}. error: {:?}, falling back to using {:?}",
|
|
||||||
self.name(),
|
|
||||||
error,
|
|
||||||
prev_downloaded_binary.path
|
|
||||||
);
|
|
||||||
binary = Ok(prev_downloaded_binary);
|
|
||||||
} else {
|
|
||||||
delegate.update_status(
|
|
||||||
self.name(),
|
|
||||||
BinaryStatus::Failed {
|
|
||||||
error: format!("{error:?}"),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Ok(binary) = &binary {
|
|
||||||
*cached_binary = Some(binary.clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
binary
|
|
||||||
}
|
}
|
||||||
.boxed_local()
|
.boxed_local()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user