question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

Environment data

  • Version: 1.54.0-insider (user setup)
  • Commit: e590188f17162393f50feec19263398e6fe02d13
  • 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! 😦

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:13

github_iconTop GitHub Comments

1reaction
karrtikrcommented, Mar 2, 2021

Thanks for the logs, I’ll try to reproduce and get back to you soon.

0reactions
karrtikrcommented, Oct 20, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio Code terminal doesn't activate Conda environment
First, open the Anaconda prompt (How to access Anaconda command prompt in Windows 10 (64-bit)), and type: conda activate tom. To activate your...
Read more >
Troubleshoot Terminal launch failures - Visual Studio Code
Troubleshooting steps · Check your user settings. Review these terminal. · Test your shell directly. Try running your designated integrated terminal shell outside ......
Read more >
Efficient Way to Activate Conda in VSCode - Medium
We simply use the one in the specific conda environment. ... Choose “Terminal: Create New Integrated Terminal (In Active Workspace); In the Terminal...
Read more >
VS Code tips — Terminal profiles - YouTube
Today's VS Code tip: terminal profilesLaunch a specific shell in the integrated terminalVS Code auto creates profiles for common shells such ...
Read more >
Manage Python environments and interpreters - Visual Studio ...
For any given project, you can select a specific environment rather than use the default. For details on creating and using virtual environments...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found