Skip to content

Creating new Integrated Terminal doesn't take selected workspace into account when activating environment #15522

@jchang10

Description

@jchang10

Environment data

  • Version: 1.54.0-insider (user setup)
  • Commit: e590188
  • Date: 2021-02-26T20:39:10.253Z
  • Electron: 11.3.0
  • Chrome: 87.0.4280.141
  • Node.js: 12.18.3
  • V8: 8.7.220.31-electron.0
  • OS: Windows_NT x64 10.0.19042
  • Python version (& distribution if applicable, e.g. Anaconda): python3.8
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): Pipenv and just venv
    -- Relevant/affected Python packages and their versions: XXX
    -- Relevant/affected Python-related VS Code extensions and their versions: XXX
    -- Value of the python.languageServer setting: XXX

Expected behaviour

This is while working with multiple projects in a workspace.

Up until recently, just a day or two ago, Selecting a "New Integrated Terminal" worked perfectly. It asks "Select current working directory for new terminal". The terminal would perfectly pick up the correct venv based on the folder's settings namely python.pythonPath.

Actual behaviour

Now, it seems to pick the venv based on the last file or editor only. If I click a workspaceX file, it uses the venv for workspaceX no matter what "Select current working directory for new terminal" directory is chosen in the prompt. :(

Steps to reproduce:

Here is a minimal example.

  1. Create new project folder test1.
  2. Create new project folder test2.
  3. cd test1; mkdir venv; python -m venv venv; touch test1.py; cd ..
  4. cd test2; mkdir venv; python -m venv venv; touch test2.py; cd ..
  5. Save project settings.
mkdir test1/.vscode
cat > test1/.vscode/settings.json
{
    "python.pythonPath": "venv/bin/python"
}                                                                                                                                                                                                                                                                                                                                                          
mkdir test2/.vscode
cat > test2/.vscode/settings.json
{
    "python.pythonPath": "venv/bin/python"
}                                                                                                                                                                                                                                                                                                                                                          
  1. Save workspace
cat > workspace.code-workspace
{
        "folders": [
                {
                        "path": "test1"
                },
                {
                        "path": "test2"
                }
        ],
        "settings": {}
}                                                                                                                                                                                                                                                                                                                                                          
  1. Now open the workspace. Select test2.py. New Integrated Terminal -> Select test1 -> you get:
    source /home/jchang/proj/tests/bugreport/test2/venv/bin/activate

This should be using test1 not test2!!! This used to work up until the last day or two! :(

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions