Fix toolchain detection for worktree-local paths (#20229)
Reimplements `pet::EnvironmentApi`, trying to access the `project_env` first Closes #20177 Release Notes: - Fixed python toolchain detection when worktree local path is set
This commit is contained in:
parent
f8bd6c66f4
commit
a26c0a8537
8 changed files with 132 additions and 13 deletions
|
@ -639,7 +639,12 @@ impl Project {
|
|||
cx.subscribe(&settings_observer, Self::on_settings_observer_event)
|
||||
.detach();
|
||||
let toolchain_store = cx.new_model(|cx| {
|
||||
ToolchainStore::local(languages.clone(), worktree_store.clone(), cx)
|
||||
ToolchainStore::local(
|
||||
languages.clone(),
|
||||
worktree_store.clone(),
|
||||
environment.clone(),
|
||||
cx,
|
||||
)
|
||||
});
|
||||
let lsp_store = cx.new_model(|cx| {
|
||||
LspStore::new_local(
|
||||
|
@ -2369,10 +2374,16 @@ impl Project {
|
|||
language_name: LanguageName,
|
||||
cx: &AppContext,
|
||||
) -> Task<Option<ToolchainList>> {
|
||||
if let Some(toolchain_store) = self.toolchain_store.as_ref() {
|
||||
toolchain_store
|
||||
.read(cx)
|
||||
.list_toolchains(worktree_id, language_name, cx)
|
||||
if let Some(toolchain_store) = self.toolchain_store.clone() {
|
||||
cx.spawn(|cx| async move {
|
||||
cx.update(|cx| {
|
||||
toolchain_store
|
||||
.read(cx)
|
||||
.list_toolchains(worktree_id, language_name, cx)
|
||||
})
|
||||
.unwrap_or(Task::Ready(None))
|
||||
.await
|
||||
})
|
||||
} else {
|
||||
Task::ready(None)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue