Invoke npm from downloaded Node

This commit is contained in:
Julia 2023-03-23 18:31:46 -04:00
parent edd6c85af7
commit ed442cfc8c
7 changed files with 45 additions and 25 deletions

View file

@ -30,15 +30,15 @@ impl LspAdapter for PythonLspAdapter {
async fn fetch_latest_server_version(
&self,
_: Arc<dyn HttpClient>,
http: Arc<dyn HttpClient>,
) -> Result<Box<dyn 'static + Any + Send>> {
Ok(Box::new(npm_package_latest_version("pyright").await?) as Box<_>)
Ok(Box::new(npm_package_latest_version(http, "pyright").await?) as Box<_>)
}
async fn fetch_server_binary(
&self,
version: Box<dyn 'static + Send + Any>,
_: Arc<dyn HttpClient>,
http: Arc<dyn HttpClient>,
container_dir: PathBuf,
) -> Result<PathBuf> {
let version = version.downcast::<String>().unwrap();
@ -49,7 +49,7 @@ impl LspAdapter for PythonLspAdapter {
let binary_path = version_dir.join(Self::BIN_PATH);
if fs::metadata(&binary_path).await.is_err() {
npm_install_packages([("pyright", version.as_str())], &version_dir).await?;
npm_install_packages(http, [("pyright", version.as_str())], &version_dir).await?;
if let Some(mut entries) = fs::read_dir(&container_dir).await.log_err() {
while let Some(entry) = entries.next().await {