-
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
python.pythonPath is automatically added to workspace settings #265
Comments
@thernstig Note: the file Note:
The extension does not automatically add these settings. It only gets added when you manually select a python interpreter.
|
I managed to reproduce it every time:
Note that it is not of importance to be in the .vscode/settings.json file when closing/opening VS Code. It happens anyway if I have a python file in focus. I just felt that doing the steps above narrows it down a bit, as we then understand that it is when a python file gets in focus. It is a private project, so I cannot upload the folder. I uploaded the online files that exist in my .vscode folder though. |
@thernstig thanks for the additional information. Please could you try the following:
Thanks. |
@DonJayamanne Late reply, busy schedule.
|
This is new information. Selecting a workspace will modify the settings file. That's where you're selection is stored. I.e. this is a user action. You could either not change the workspace interpreter of change your default interpreter (in your current PATH). |
@DonJayamanne I am not sure I follow the logic here. I selected the default workspace interpreter. Why should the workspace settings file be automatically altered when a workspace is selected? I have not saved anything in that file. It makes no sense to propage the workspace setting file to other users of the git repo for why I personally keep my virtual environment. edit: Also note this has never happened before as long as I have used VS Code and python, this started to happen recently. edit2: I did not select a workspace interpreter at first. Step 3 above was a new way I did this. The problem happens without me changing the interpreter as soon as I start VS code if I am inside a python file. |
The change needs to be saved, otherwise you would have to make the change every time you re-open VS Code. And the change doesn't have to propagate to other users if you don't save your |
I have the same setting configured in my user settings so they are not needed in the workspace settings. I want to re-iterate that this auto-add-config to the workspace settings has not happened before. |
Let's put it like this instead. Let's say I have a bunch of VS code workspace settings I want every developer of a project to use. It means I version handle the settings.json file. Now, every developer has various places they put their virtual environment. This would mean that if the workspace settings (settings.json) has to be altered if a user changes their workspace interpreter, they would have to make sure to not check in the settings.json file everytime and revert the automatic change done by the python plugin. Am I missing something there? |
No, I don't think you're missing anything. Unfortunately we don't control the configuration setup to provide you with an equivalent user-specific, workspace setting. As for saving the config, I believe we added this in the 0.8.0 release as part of our support for multi-root. |
@brettcannon I have set the pythonpath settings inside my user settings. That is why I get the option to select it as a interpreter. When it is selected, it also adds it to the workspace settings Shouldn't it be so that if I select my workspace from the user settings, it should not automatically add it to the workspace settings? The way it works now is it means I can never have a settings.json file for my workspace and thus all developer of the project. That cannot be the intention for VS code to work like that? |
No, we don't propagate settings from user settings to workspace settings for users as that simply isn't how VS Code does things. |
Ok, I am not sure how I am supposed to have a settings.json file for my project anymore due to this. The Python extension changes where the interpreter is located for everyone in the project even though we all do not have virtual env in the same location. It means everyone always have to undo changes in settings.json before commiting to git. I have not seen any logical answer on how I should handle this, only that "it is supposed to work like that". |
You haven't seen an answer because we simply don't have one to provide, unfortunately. VS Code doesn't give us a mechanism to provide you with a solution that you're after. You could maybe try filing a bug against VS Code asking for what would essentially be a "global/team" workspace |
@brettcannon As I understand it, the current settings.json already is a "global/team" workspace setting in all its intention? For example, in this thread microsoft/vscode#851 the user bpasero (his team started VS Code when it was still called Monaco) says:
I am not sure in what ever other way to put this. If I have already set my own user settings to I'm giving up now, I just cannot stress how unintuitive it is. Please do not mistake my frustration with how it works with you guys, you are providing excellent support in even taking the time to answer. I am just at loss on what to do if my entire future workflow for projects require people to undo changes in settings.json. Your idea to file an issue about this might be good. It won't help for the time being unfortunately. |
@thernstig I'm sorry, but you're not making any sense here.
|
@DonJayamanne I believe I have been very thorough in highlighting the difference between user settings and workspace settings (by bolding it several times) The first part you quote is for user settings and the second part you quote is for workspace settings This bug breaks the entire logic of having the workspace settings version controlled since it automatically alters the workspace setting. I will outline it again like this:
Everytime I say "workspace setting" I am refering to the file inside the workspace folder under .vscode/settings.json |
Ok, I understand the issue now. The problem is that we're automatically detecting the virtual environment and setting it, even though it has already been configured in the user settings. |
That is great news. Thanks. |
Environment data
VS Code version: 1.18.1
Python Extension version: 0.8.0 (9 November 2017)
Python Version: 3.6.1
OS and version: Windows 10 Home, Version 1703, OS-version 15063.483
Actual behavior
At certain points when working in VS Code (starting VS Code is one example) it automatically adds the configuration "python.pythonPath" to the WORKSPACE SETTINGS file (vscode/settings.json).
Good to know is that the project has a .vscode/extensions.json file with the following content:
Also good to know is that I have "python.pythonPath" configured in my USER SETTINGS.
Expected behavior
It is not expected for the "python.pythonPath" to be automatically added to the .vscode/settings.json file.
Steps to reproduce:
The text was updated successfully, but these errors were encountered: