@@ -57,7 +57,7 @@ use std::{
str,
sync::{
Arc, LazyLock,
- atomic::{AtomicU64, AtomicUsize, Ordering::SeqCst},
+ atomic::{AtomicUsize, Ordering::SeqCst},
},
};
use syntax_map::{QueryCursorHandle, SyntaxSnapshot};
@@ -166,7 +166,6 @@ pub struct CachedLspAdapter {
pub disk_based_diagnostics_progress_token: Option<String>,
language_ids: HashMap<LanguageName, String>,
pub adapter: Arc<dyn LspAdapter>,
- pub reinstall_attempt_count: AtomicU64,
cached_binary: futures::lock::Mutex<Option<LanguageServerBinary>>,
}
@@ -183,7 +182,6 @@ impl Debug for CachedLspAdapter {
&self.disk_based_diagnostics_progress_token,
)
.field("language_ids", &self.language_ids)
- .field("reinstall_attempt_count", &self.reinstall_attempt_count)
.finish_non_exhaustive()
}
}
@@ -202,7 +200,6 @@ impl CachedLspAdapter {
language_ids,
adapter,
cached_binary: Default::default(),
- reinstall_attempt_count: AtomicU64::new(0),
})
}
@@ -1181,6 +1181,10 @@ impl LspAdapter for PyLspAdapter {
"pylsp-mypy installation failed"
);
let pylsp = venv.join(BINARY_DIR).join("pylsp");
+ delegate
+ .which(pylsp.as_os_str())
+ .await
+ .context("pylsp installation was incomplete")?;
Ok(LanguageServerBinary {
path: pylsp,
env: None,
@@ -1195,6 +1199,7 @@ impl LspAdapter for PyLspAdapter {
) -> Option<LanguageServerBinary> {
let venv = self.base_venv(delegate).await.ok()?;
let pylsp = venv.join(BINARY_DIR).join("pylsp");
+ delegate.which(pylsp.as_os_str()).await?;
Some(LanguageServerBinary {
path: pylsp,
env: None,
@@ -1364,9 +1369,11 @@ impl BasedPyrightLspAdapter {
.arg("venv")
.arg("basedpyright-venv")
.current_dir(work_dir)
- .spawn()?
+ .spawn()
+ .context("spawning child")?
.output()
- .await?;
+ .await
+ .context("getting child output")?;
}
Ok(path.into())
@@ -1470,9 +1477,13 @@ impl LspAdapter for BasedPyrightLspAdapter {
.success(),
"basedpyright installation failed"
);
- let pylsp = venv.join(BINARY_DIR).join(Self::BINARY_NAME);
+ let path = venv.join(BINARY_DIR).join(Self::BINARY_NAME);
+ delegate
+ .which(path.as_os_str())
+ .await
+ .context("basedpyright installation was incomplete")?;
Ok(LanguageServerBinary {
- path: pylsp,
+ path,
env: None,
arguments: vec!["--stdio".into()],
})
@@ -1484,9 +1495,10 @@ impl LspAdapter for BasedPyrightLspAdapter {
delegate: &dyn LspAdapterDelegate,
) -> Option<LanguageServerBinary> {
let venv = self.base_venv(delegate).await.ok()?;
- let pylsp = venv.join(BINARY_DIR).join(Self::BINARY_NAME);
+ let path = venv.join(BINARY_DIR).join(Self::BINARY_NAME);
+ delegate.which(path.as_os_str()).await?;
Some(LanguageServerBinary {
- path: pylsp,
+ path,
env: None,
arguments: vec!["--stdio".into()],
})