prefix-dev / pixi

Package management made easy
https://pixi.sh
BSD 3-Clause "New" or "Revised" License
2.95k stars 162 forks source link

in VS Code, manifest PIXI_PROJECT_MANIFEST is not changed when open by command "code <path>" #1907

Open wbfw109 opened 3 weeks ago

wbfw109 commented 3 weeks ago

Checks

Reproducible example

Environments

Projects

Directory Structure

parent ├── pixi-py └── pixi/examples/cpp-sdl

Steps to Reproduce

  1. Navigate to the cpp-sdl directory from pixi-py:

    # In the pixi-py directory
    cd ../pixi/examples/cpp-sdl
    code .
  2. In the terminal of the VS Code window for Project B, run the following command:

    pixi list

Issue description

Expected Output

will must output non-warning, but output is

WARN Used manifest C:\tools\msys64\home\<...parent>\pixi-py\pyproject.toml from PIXI_PROJECT_MANIFEST rather than local C:\tools\msys64\home\<...parent>\pixi\examples\cpp-sdl\pixi.toml

🚨 pixi always uses the previous project's environment, so pixi commands don't make sense for Project B. F1 (> Reload Windows) in VS Code not affects the result..

💡 Workaround

// 📅 2024-08-26 23:57:14 modified (; add details)

  1. Add these into .vscode/settings.json in your pixi project.

    "python.defaultInterpreterPath": ".\.pixi\envs\default\python.exe", // ⚠️ if you replace "\" with "/" error occurs in Windows. // in the case of Windows environment

  2. and If you open the project in a new VS Code window (Ctrl+Shift+N) and run the command, no warning appears.

Expected behavior

No error and Warning.

ruben-arts commented 3 weeks ago

Thanks for the detailed report!

This is coming from the design decision to stay in the current activated environment while moving around on the file system. But since the environment is activated automatically this doesn't sound like a good decision anymore.

I think we should rethink that behavior.