Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix micromamba powershell activation (#55643)

Adam Ehlers Nyholm Thomsenb5abd9d2fe08
diff --git a/crates/languages/src/python.rs b/crates/languages/src/python.rs
index 5cdff8654ff..26e96789a0d 100644
--- a/crates/languages/src/python.rs
+++ b/crates/languages/src/python.rs
@@ -1259,7 +1259,7 @@ fn micromamba_shell_name(kind: ShellKind) -> &'static str {
ShellKind::Csh => "csh",
ShellKind::Fish => "fish",
ShellKind::Nushell => "nu",
- ShellKind::PowerShell => "powershell",
+ ShellKind::PowerShell | ShellKind::Pwsh => "powershell",
ShellKind::Cmd => "cmd.exe",
// default / catch-all:
_ => "posix",
@@ -1470,9 +1470,17 @@ impl ToolchainLister for PythonToolchainProvider {
// Activate micromamba shell in the child shell
// [required for micromamba]
if manager == "micromamba" {
- let shell = micromamba_shell_name(shell);
- activation_script
- .push(format!(r#"eval "$({manager} shell hook --shell {shell})""#));
+ match shell {
+ ShellKind::PowerShell | ShellKind::Pwsh => {
+ activation_script.push(format!(r#"(& {manager} shell hook --shell powershell) | Out-String | Invoke-Expression"#));
+ }
+ _ => {
+ let shell_name = micromamba_shell_name(shell);
+ activation_script.push(format!(
+ r#"eval "$({manager} shell hook --shell {shell_name})""#
+ ));
+ }
+ }
}
if let Some(name) = &toolchain.environment.name {