languages: Invoke conda activate in conda environments (#37627)

Lukas Wirth created

This isn't quite right, but using the env manager path causes conda to
scream and I am not yet sure why, either way this is an improvement over
the status quo

Release Notes:

- N/A\

Change summary

crates/languages/src/python.rs | 7 +++++++
1 file changed, 7 insertions(+)

Detailed changes

crates/languages/src/python.rs 🔗

@@ -902,6 +902,13 @@ impl ToolchainLister for PythonToolchainProvider {
                 let env = toolchain.name.as_deref().unwrap_or("default");
                 activation_script.push(format!("pixi shell -e {env}"))
             }
+            Some(PythonEnvironmentKind::Conda) => {
+                if let Some(name) = &toolchain.name {
+                    activation_script.push(format!("conda activate {name}"));
+                } else {
+                    activation_script.push("conda activate".to_string());
+                }
+            }
             Some(PythonEnvironmentKind::Venv | PythonEnvironmentKind::VirtualEnv) => {
                 if let Some(prefix) = &toolchain.prefix {
                     let activate_keyword = match shell {