toolchain: Respect currently focused file when querying toolchains (#28875)
Closes #21743 https://github.com/user-attachments/assets/0230f233-58a4-494c-90af-28ce82f9fc1d Release Notes: - Virtual environment picker now looks up virtual environment based on parent directory of active file; this enables having multiple active virtual environments in a single worktree.
This commit is contained in:
parent
4f58bdee28
commit
5c2c6d7e5e
6 changed files with 77 additions and 21 deletions
|
@ -1334,17 +1334,18 @@ impl WorkspaceDb {
|
|||
&self,
|
||||
workspace_id: WorkspaceId,
|
||||
worktree_id: WorktreeId,
|
||||
relative_path: String,
|
||||
language_name: LanguageName,
|
||||
) -> Result<Option<Toolchain>> {
|
||||
self.write(move |this| {
|
||||
let mut select = this
|
||||
.select_bound(sql!(
|
||||
SELECT name, path, raw_json FROM toolchains WHERE workspace_id = ? AND language_name = ? AND worktree_id = ?
|
||||
SELECT name, path, raw_json FROM toolchains WHERE workspace_id = ? AND language_name = ? AND worktree_id = ? AND relative_path = ?
|
||||
))
|
||||
.context("Preparing insertion")?;
|
||||
|
||||
let toolchain: Vec<(String, String, String)> =
|
||||
select((workspace_id, language_name.as_ref().to_string(), worktree_id.to_usize()))?;
|
||||
select((workspace_id, language_name.as_ref().to_string(), worktree_id.to_usize(), relative_path))?;
|
||||
|
||||
Ok(toolchain.into_iter().next().and_then(|(name, path, raw_json)| Some(Toolchain {
|
||||
name: name.into(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue