crates/language/src/toolchain.rs 🔗
@@ -24,7 +24,7 @@ pub struct Toolchain {
pub as_json: serde_json::Value,
}
-#[async_trait(?Send)]
+#[async_trait]
pub trait ToolchainLister: Send + Sync {
async fn list(
&self,
Piotr Osiewicz created
Potentially fixes #21404
This is a speculative fix, as while I was trying to repro this issue
I've noticed that introducing artificial delays in ToolchainLister::list
could impact apps responsiveness. These delays were essentially there to
stimulate PET taking a while to find venvs.
Release Notes:
- Improved app responsiveness in environments with multiple Python
virtual environments
crates/language/src/toolchain.rs | 2 +-
crates/languages/src/python.rs | 2 +-
crates/project/src/toolchain_store.rs | 14 ++++++++------
3 files changed, 10 insertions(+), 8 deletions(-)
@@ -24,7 +24,7 @@ pub struct Toolchain {
pub as_json: serde_json::Value,
}
-#[async_trait(?Send)]
+#[async_trait]
pub trait ToolchainLister: Send + Sync {
async fn list(
&self,
@@ -536,7 +536,7 @@ fn env_priority(kind: Option<PythonEnvironmentKind>) -> usize {
}
}
-#[async_trait(?Send)]
+#[async_trait]
impl ToolchainLister for PythonToolchainProvider {
async fn list(
&self,
@@ -311,12 +311,14 @@ impl LocalToolchainStore {
})
.ok()?
.await;
- let language = registry.language_for_name(&language_name.0).await.ok()?;
- let toolchains = language
- .toolchain_lister()?
- .list(root.to_path_buf(), project_env)
- .await;
- Some(toolchains)
+
+ cx.background_executor()
+ .spawn(async move {
+ let language = registry.language_for_name(&language_name.0).await.ok()?;
+ let toolchains = language.toolchain_lister()?;
+ Some(toolchains.list(root.to_path_buf(), project_env).await)
+ })
+ .await
})
}
pub(crate) fn active_toolchain(