terminal: Allow configuring conda manager (#40577)
Closes #40576 This PR makes Conda activation configurable and transparent by adding a `terminal.detect_venv.on.conda_manager` setting (`"auto" | "conda" | "mamba" | "micromamba"`, default `"auto"`), updating Python environment activation to honor this preference (or the detected manager executable) and fall back to `conda` when necessary. The preference is passed via `ZED_CONDA_MANAGER` from the terminal settings, and the activation command is built accordingly (with proper quoting for paths). Changes span `zed/crates/terminal/src/terminal_settings.rs` (new `CondaManager` and setting), `zed/crates/project/src/terminals.rs` (inject env var), `zed/crates/languages/src/python.rs` (activation logic), and `zed/assets/settings/default.json` (document the setting). Default behavior remains unchanged for most users while enabling explicit selection of `mamba` or `micromamba`. Release Notes: - Added: terminal.detect_venv.on.conda_manager setting to choose the Conda manager (auto, conda, mamba, micromamba). Default: auto. - Changed: Python Conda environment activation now respects the configured manager, otherwise uses the detected environment manager executable, and falls back to conda. - Reliability: Activation commands quote manager paths to handle spaces across platforms. - Compatibility: No breaking changes; non-Conda environments are unaffected; remote terminals are supported. --------- Co-authored-by: Lukas Wirth <me@lukaswirth.dev> Co-authored-by: Lukas Wirth <lukas@zed.dev>
This commit is contained in:
co-authored by
Lukas Wirth
Lukas Wirth
parent
082b80ec89
commit
9d52b6c538
@@ -9,7 +9,7 @@ use std::{path::PathBuf, sync::Arc};
|
||||
use async_trait::async_trait;
|
||||
use collections::HashMap;
|
||||
use fs::Fs;
|
||||
use gpui::{AsyncApp, SharedString};
|
||||
use gpui::{App, AsyncApp, SharedString};
|
||||
use settings::WorktreeId;
|
||||
use task::ShellKind;
|
||||
use util::rel_path::RelPath;
|
||||
@@ -110,7 +110,7 @@ pub trait ToolchainLister: Send + Sync + 'static {
|
||||
fs: &dyn Fs,
|
||||
) -> anyhow::Result<Toolchain>;
|
||||
|
||||
fn activation_script(&self, toolchain: &Toolchain, shell: ShellKind) -> Vec<String>;
|
||||
fn activation_script(&self, toolchain: &Toolchain, shell: ShellKind, cx: &App) -> Vec<String>;
|
||||
|
||||
/// Returns various "static" bits of information about this toolchain lister. This function should be pure.
|
||||
fn meta(&self) -> ToolchainMetadata;
|
||||
|
||||
Reference in New Issue
Block a user