toolchains: Add support for relative paths (#27777)

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-03-31 19:48:09 +02:00 committed by GitHub
parent 627ae7af6f
commit edf712d45b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 178 additions and 93 deletions

View file

@ -9,7 +9,7 @@ use gpui::{
};
use language::{LanguageName, Toolchain, ToolchainList};
use picker::{Picker, PickerDelegate};
use project::{Project, WorktreeId};
use project::{Project, ProjectPath, WorktreeId};
use std::{path::Path, sync::Arc};
use ui::{prelude::*, HighlightedLabel, ListItem, ListItemSpacing};
use util::ResultExt;
@ -169,7 +169,14 @@ impl ToolchainSelectorDelegate {
});
let available_toolchains = project
.update(cx, |this, cx| {
this.available_toolchains(worktree_id, language_name, cx)
this.available_toolchains(
ProjectPath {
worktree_id,
path: Arc::from("".as_ref()),
},
language_name,
cx,
)
})
.ok()?
.await?;
@ -241,13 +248,20 @@ impl PickerDelegate for ToolchainSelectorDelegate {
let worktree_id = self.worktree_id;
cx.spawn_in(window, async move |_, cx| {
workspace::WORKSPACE_DB
.set_toolchain(workspace_id, worktree_id, toolchain.clone())
.set_toolchain(workspace_id, worktree_id, "".to_owned(), toolchain.clone())
.await
.log_err();
workspace
.update(cx, |this, cx| {
this.project().update(cx, |this, cx| {
this.activate_toolchain(worktree_id, toolchain, cx)
this.activate_toolchain(
ProjectPath {
worktree_id,
path: Arc::from("".as_ref()),
},
toolchain,
cx,
)
})
})
.ok()?