-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Creating new Integrated Terminal doesn't take selected workspace into account when activating environment #15522
Comments
Hi @jchang10 👋 Please provide the logs as mentioned in the issue template, also what extension version are you using? LogsOutput for
|
Hi. Sorry. ms-python version ms-python.python-2021.2.582707922. I am on the nightly build. Below is my entire python log output after a window reload. Not seeing anything major. The weird thing is that this is what my terminal windows shows after New Terminal. I only have test2.py showing in the editor. I do New Terminal -> Select test1 as my working dir, and this is what I get. It correctly opens a terminal with the directory in test1, but the environment is from test2!
|
Thanks for the logs, I'll try to reproduce and get back to you soon. |
@jchang10 I'm able to reproduce this issue, thanks! Although that is how it always used to work. vscode-python/src/client/terminals/activation.ts Lines 44 to 48 in c11009f
As the comment states we were waiting on VSCode for the fix on microsoft/vscode#63052. Looks like it has been fixed, so we'll need to change that line to get Passing the following as const cwd =
'cwd' in terminal.creationOptions
? terminal.creationOptions.cwd
: this.activeResourceService.getActiveResource();
const resource = typeof cwd === 'string' ? Uri.file(cwd) : cwd; You're welcome to fix it as well. |
Can I get in on this issue? |
@ShahzaibParacha Sure. Just FYI I have mentioned the fix here #15522 (comment) |
is this issue still open I would like to work on this. |
I'm working on it. |
Not sure if some of these issues are related to depreciate python path experiment: I resolved the issue by adding the following to my user/settings.json and making sure that in my project settings.json i had: |
@KamalSinghKhanna As it's been a while, you can give it a shot too. @ShahzaibParacha Are you still tackling it? |
I think I can provide some more context here - I have two completely different Python projects that I'd like to be able to compare. They both have virtual environments created with pipenv. If I set the interpreter for the workspace on both environments, as long as no other instances of vscode (VSCodium) are running everything works as expected; new terminal windows launch the correct interpreter. If one workspace is already open the second workspace can be opened, but new terminal windows will NOT use the interpreter saved as a preference. If the first workspace is closed and the second (re)opened, new terminal windows behave as expected. There seems to be some crosstalk between multiple open vscode workspaces on the same machine. (possibly an inadvertent global in node?) IMO more isolation would be very desirable. Temporary work-around is to only open one workspace at a time, or to manually run Thanks, and good luck! Gordon VSCodium (Cinnamon desktop on Debian 11) |
Can I get assigned to this? Thanks! |
… account when activating environment (#17595) * Worked on issue #15522 * worked on #15522 issue * added #15522 issue fix and contributor name * Impored Uri from VSCode * imported Uri correctly * imported Uri correctly * used short hand property on line 61 * formatted document using prettier * formatted code using prettier * formatted code using prettier * updated formatting of the document used 4 tab spaces in prettier * Fix formatting. Co-authored-by: Karthik Nadig <[email protected]>
… account when activating environment (microsoft#17595) * Worked on issue microsoft#15522 * worked on microsoft#15522 issue * added microsoft#15522 issue fix and contributor name * Impored Uri from VSCode * imported Uri correctly * imported Uri correctly * used short hand property on line 61 * formatted document using prettier * formatted code using prettier * formatted code using prettier * updated formatting of the document used 4 tab spaces in prettier * Fix formatting. Co-authored-by: Karthik Nadig <[email protected]>
… account when activating environment (#17595) * Worked on issue #15522 * worked on #15522 issue * added #15522 issue fix and contributor name * Impored Uri from VSCode * imported Uri correctly * imported Uri correctly * used short hand property on line 61 * formatted document using prettier * formatted code using prettier * formatted code using prettier * updated formatting of the document used 4 tab spaces in prettier * Fix formatting. Co-authored-by: Karthik Nadig <[email protected]>
Fixed with #17595 |
Environment data
-- 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: XXXExpected 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.
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! :(
The text was updated successfully, but these errors were encountered: