Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test multiroot support for terminal activation using environment variables #21102

Closed
3 tasks done
karrtikr opened this issue Apr 21, 2023 · 2 comments
Closed
3 tasks done
Labels
testplan-item Test plan item/assignments for upcoming release
Milestone

Comments

@karrtikr
Copy link

karrtikr commented Apr 21, 2023

Refs: #21101

Complexity: 5

Create Issue


Requirements

Similar to #20884 hence preassigning. Make sure to check the (new) requirements.

  • Python extension pre-release
  • Latest VSCode Insiders
  • Virtual or conda environment
    • Install conda via: https://conda.io/projects/conda/en/latest/user-guide/install/index.html. Make sure it's on PATH during installation.
      • Run conda init to initialize the shell.
      • (new) Run conda config --set auto_activate_base False.
      • Restart shell for changes to take effect.
      • Create conda env using conda create -n <name> python -y.
    • Use python -m venv <name> to create virtual envs.

Verification

  • Add following to user settings and reload window:
"python.experiments.optInto": ["pythonTerminalEnvVarActivation"]
  • Use a workspace with multiple workspace folders. (File -> Add folder to workspace...)

  • For each workspace folder:

    • Activate Python extension by opening a Python file.
    • Select a virtual or conda environment using Python: Select Interpreter command. This should be different for each folder.
  • Open multiple terminals for each workspace folder:
    image

  • For each workspace folder, w:

    • Make sure terminal for w is activated using the selected environment for w. Run the following in terminal:
      python -c"import sys;print(sys.executable)"
      
    • Output should contain the path to interpreter selected. For eg. for .venv created via python -m venv .venv it looks something like:
      C:\Users\karraj\OneDrive - Microsoft\Desktop\folders\crap\.venv\Scripts\python.exe
      
    • Hover over the tab title, note Python has a description for which env is activated next to it:

    image

    • Run some random commands in the terminal, then change environment using Python: Select Interpreter command, a warning sign should appear to the right of terminal with new env changes that're about to be made:

    image

    • Click show environment contributions highlighted above, make sure the environment variables are for the right environment:

      image

@karrtikr karrtikr added the testplan-item Test plan item/assignments for upcoming release label Apr 21, 2023
@karrtikr karrtikr added this to the April 2023 milestone Apr 21, 2023
@github-actions github-actions bot added invalid-testplan-item testplan-item Test plan item/assignments for upcoming release and removed testplan-item Test plan item/assignments for upcoming release invalid-testplan-item labels Apr 21, 2023
@aiday-mar
Copy link

aiday-mar commented Apr 25, 2023

Hi @karrtikr, great work here. I have just been testing the fix. I opened two workspace folders into which I placed a python file each and selected different interpreters for each. I created two terminals per workspace folder. When I change the interpreter for one of the folders, one of the terminal labels becomes yellow, but not the second one, despite them being associated to the same folder. Upon clicking on the show contributions button, the same file is opened for both terminals. I was wondering if this is intended?

Screen.Recording.2023-04-25.at.11.40.15.mov

@aiday-mar aiday-mar removed their assignment Apr 25, 2023
@karrtikr
Copy link
Author

karrtikr commented Apr 25, 2023

@aiday-mar Thanks for identifying this! it does look like either a limitation of the API or a bug.

but not the second one, despite them being associated to the same folder.

⚠️ signs only appears next to terminals which are dirty, as they require a relaunch to update the envs. The second has not been interacted with yet, so envs are updated without the need for relaunching it, but it seems that the description is not updated microsoft/vscode#180851.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
testplan-item Test plan item/assignments for upcoming release
Projects
None yet
Development

No branches or pull requests

5 participants