You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3bcc859
Browse filesBrowse the repository at this point in the historyBrowse files
fix: skip terminal activation when there is no activate script (#1801)
Fixes#1775
## Problem
When an interpreter's `bin/` has no `activate` script,
`getShellActivationCommands(binDir)` still emitted `source
<bin>/activate` for sh, bash, zsh, Git Bash, ksh and the `unknown`
fallback. `uv python install` toolchains are an example: they're base
interpreters, not virtual environments. Every new terminal then ran a
failing command:
```
source: no such file or directory: ~/.local/share/uv/python/cpython-3.13.9-macos-aarch64-none/bin/activate
```
The other shells (csh, fish, xonsh, nu, pwsh, cmd) were already gated on
their script existing.
## Fix
- `getShellActivationCommands` only adds the `activate`-based entries
(`unknown`, sh, bash, Git Bash, zsh, ksh) when `<binDir>/activate`
exists. This matches how the other shells are handled. Real venvs,
pipenv and poetry environments always ship `activate`, so they're
unaffected.
- `isActivatableEnvironment` now requires a non-empty `shellActivation`
map. It used to check only that the map existed, so an environment with
no activation commands was still offered for activation (the terminal
activate button and command-based auto-activation).
## Tests
- New tests in `utils.getShellActivationCommands.unit.test.ts`:
- no POSIX or `unknown` activation without an `activate` script, on
non-Windows and on Windows;
- activation is still emitted when the script exists.
- New `src/test/features/common/activation.unit.test.ts` covers
`isActivatableEnvironment`, including the empty-map case.
- Two existing tests ("Bash activation does not include
Set-ExecutionPolicy" and "Windows unknown shell uses activate…") now
create the `activate` file they rely on.
- Unit tests (`tsc` + mocha, Node 22):
- with the change: 2411 passing;
- without it: the 3 new tests covering the bug fail.
- `eslint` and `prettier --check` are clean on the changed files.
I did not test this manually in VS Code with a real uv toolchain. The
fix is covered by the unit tests above.
This change was written with help from an AI coding assistant (Claude
Code). I reviewed and tested it as described above.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
0 commit comments