Repository navigation
Conversation
The Python Environments extension quotes the activation executable and runs it with Invoke-Expression. PowerShell parses a leading quoted path as a string expression, so activation failed with "Unexpected token 'shell'" whenever the pixi path contained a space. Provide a pwsh-specific shellActivation that prefixes the call operator '&', the same approach the built-in venv and conda managers use. Other shells keep using activation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes it by putting PowerShell's call operator
&in front of the command, so the quoted path runs as a command. I tested the fix by running the extension from source (F5 / Extension Development Host): PowerShell and cmd both activate the environment.AI-assisted details (written with Claude Code)
Fixes #56.
Change (
src/pixi/utils.ts)execInfo.shellActivationwith a singlepwshentry:{ executable: '&', args: [pixi, 'shell', '--manifest-path', <manifest>, '-e', <env>] }.pwshkey covers both Windows PowerShell 5.1 and PowerShell 7.quoteArgsleaves a lone&unquoted, so the result is& "C:\...\pixi.exe" shell ....activationunchanged (pergetShellActivationCommand).shellargs into ashellArgsconst to avoid duplication.Checks
npm run lint,npm run format:checkandnpm run compileall pass.Testing
& "C:\Users\First Last\.pixi\bin\pixi.EXE" shell --manifest-path D:\Projects\LearningMLDL\pixi.toml -e default→ prompt becomes(LearningMLDL) PS …. Before this change, the same terminal failed withUnexpected token 'shell'."C:\…\pixi.EXE" shell …→(LearningMLDL) ….Side note for anyone testing via F5: when the extension runs from a folder whose path doesn't contain
renan-r-santos.pixi-code(e.g. a plainpixi-codeclone), Python Environments' caller detection files the manager asms-python.python:pixi. Selecting a Pixi env then fails withNo environment manager found for [renan-r-santos.pixi-code:pixi]. For local testing only, I passed{ extensionId: 'renan-r-santos.pixi-code' }toregisterEnvironmentManager/registerPackageManager. That isn't part of this PR, but it could be worth doing for robustness.Notes
pixi shell-hookviashellActivationand would conflict with this. Its pwsh entry interpolates${pixi}unquoted into(& ${shellHookCmd}), so it would hit the same spaced-path problem. If Add CLI options and use shell-hook for activation #26 lands instead, quotingpixithere would cover this case.🤖 Generated with Claude Code