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

Fallback to path for environmentTypeComparer #16893

Merged
merged 3 commits into from
Aug 10, 2021

Conversation

cdce8p
Copy link

@cdce8p cdce8p commented Aug 7, 2021

I noticed that local environments weren't sorted correctly with pythonSortEnvs. Upon further investigation I found the issue was that PythonEnvironment only contained the path variable and not envPath. Thus the check failed to identify local environments correctly.

This PR would fix the issue. It is however primarily meant to help identify and narrow down the issue.

Steps to reproduce it:

  1. Open a folder or workspace in VS Code
  2. Create a virtual env with python -m venv venv
  3. Run Python: Select Interpreter command

--
macOS Catalina (10.15.7)
VS Code: 1.59.0

--
Current
Screen Shot 2021-08-08 at 00 28 23

With PR
Screen Shot 2021-08-08 at 00 27 18

Debug output
Screen Shot 2021-08-08 at 00 18 17

--
Python extension log output

User belongs to experiment group 'pythonSortEnvs'
User belongs to experiment group 'pythonaa'
User belongs to experiment group 'pythonSendEntireLineToREPL'
User belongs to experiment group 'pythonNotDisplayLinterPrompt'
User belongs to experiment group 'pythonDiscoveryModuleWithoutWatcher'
User belongs to experiment group 'pythonTensorboardExperiment'
User belongs to experiment group 'PythonPyTorchProfiler'
Python interpreter path: ./venv-310/bin/python
> pyenv root
> conda --version
> python3.7 -c "import sys;print(sys.executable)"
> python3.6 -c "import sys;print(sys.executable)"
> python3 -c "import sys;print(sys.executable)"
> python2 -c "import sys;print(sys.executable)"
> python -c "import sys;print(sys.executable)"
> ~/Develop/test-files/venv-310/bin/python -c "import sys;print(sys.executable)"
> conda info --json
Starting Pylance language server.
> conda --version

Copy link
Member

@karthiknadig karthiknadig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. This looks pretty good, also thanks for adding test for the change.

news/2 Fixes/16893.md Show resolved Hide resolved
@karthiknadig karthiknadig requested a review from kimadeline August 9, 2021 03:21
Co-authored-by: Karthik Nadig <kanadig@microsoft.com>
@karthiknadig karthiknadig merged commit a477bed into microsoft:main Aug 10, 2021
@cdce8p cdce8p deleted the fix-sort-envs branch August 10, 2021 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants