-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
VS Code version
1.62.2
Extension version
v2021.11.1422169775
OS type
Windows
OS version
Windows 10
Python distribution
python.org
Python version
3.6.5
Language server
Default
Expected behaviour
The python extension now uses an internally stored python interpreter path or it will fall back to the default path in the settings. The following order is applied:
- Python path defined within the extension on folder level
- Python path defined within the extension on workspace level
- Python path defined within the folder settings (python.defaultInterpreterPath)
- Python path defined within the workspace settings (python.defaultInterpreterPath)
- Python path defined within the user settings (python.defaultInterpreterPath)
The documentation (e.g. here https://github.com/microsoft/vscode-python/wiki/AB-Experiments) clearly states that the python.defaultInterpreterPath setting is only read but never modified by the extension.
If a python interpreter is selected using the command "Python: Select Interpreter" the selection is stored "internally" and the settings.json is not affected.
Actual behaviour
When working with a single .py file only, no folder or workspace loaded, using the "Python: Select Interpreter" or "Python: Clear Workspace Interpreter Setting" command will add/change/remove the python.defaultInterpreterPath within the users settings.json.
Steps to reproduce
- load any python file in an empty VSCode instance
- VSC will probably use the "recommended" python interpreter
- open the user settings.json and define a "python.defaultInterpreterPath" (best to use a different python than the recommended one)
- use the command "Python: Select Interpreter" to pick a different interpreter
- observe that the defaultInterpreterPath has been changed
- use the command "Python: Clear Workspace Interpreter Setting"
- observe that the defaultInterpreterPath is completely removed from the settings
Logs
No response
Code of Conduct
- I agree to follow this project's Code of Conduct