From 442c2364025401f81a8a2d45dea4a8f8c123f1e7 Mon Sep 17 00:00:00 2001 From: Xin Zhao Date: Sat, 10 Jan 2026 02:48:37 +0800 Subject: [PATCH] languages: Fix Python venv auto-activation for PowerShell 7 (#46465) Summary This PR fixes an issue where Python virtual environments (`venv`, `uv`, etc.) were not automatically activated when opening a terminal using PowerShell 7. Details `ShellKind` distinguishes between the legacy Windows PowerShell (`ShellKind::PowerShell`) and the newer PowerShell 7 (`ShellKind::Pwsh`). Previously, the logic in `resolve_venv_activation_scripts` only checked for `ShellKind::PowerShell`, causing `activate.ps1` resolution to fail for `Pwsh` users. This change adds `ShellKind::Pwsh` to the resolution list, mapping it to `activate.ps1` just like the legacy PowerShell. Release Notes: - Fixed Python virtual environments not automatically activating in PowerShell 7 --- crates/languages/src/python.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/languages/src/python.rs b/crates/languages/src/python.rs index 2ec6bef8f2893aa3d42d64d7c09c7e9cb18682c4..81a9971b2743d6c27368bbaf3bb6e770b2aeccc1 100644 --- a/crates/languages/src/python.rs +++ b/crates/languages/src/python.rs @@ -1462,6 +1462,7 @@ async fn resolve_venv_activation_scripts( (ShellKind::Fish, "activate.fish"), (ShellKind::Nushell, "activate.nu"), (ShellKind::PowerShell, "activate.ps1"), + (ShellKind::Pwsh, "activate.ps1"), (ShellKind::Cmd, "activate.bat"), (ShellKind::Xonsh, "activate.xsh"), ] {