Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toolchains: Run listing tasks on background thread (cherry-pick #21414) #21421

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/language/src/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct Toolchain {
pub language_name: LanguageName,
}

#[async_trait(?Send)]
#[async_trait]
pub trait ToolchainLister: Send + Sync {
async fn list(
&self,
Expand Down
2 changes: 1 addition & 1 deletion crates/languages/src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ fn env_priority(kind: Option<PythonEnvironmentKind>) -> usize {
}
}

#[async_trait(?Send)]
#[async_trait]
impl ToolchainLister for PythonToolchainProvider {
async fn list(
&self,
Expand Down
14 changes: 8 additions & 6 deletions crates/project/src/toolchain_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,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(
Expand Down
Loading