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

pythonPath goes wrong when there are multiple folders under a workspace #43593

Closed
Tantalus13A98B5F opened this issue Feb 13, 2018 · 1 comment
Assignees

Comments

@Tantalus13A98B5F
Copy link

Issue Type

Bug

Description

I have a workspace which is a website, containing a folder for vue.js and another for django. In the settings.json of the workspace, the folder of django goes after the the folder of vue.js. The pythonPath of the folder of django is set to the path of a virtualenv. Everything is okay if I just open the folder of django. However, if I open the folders in the workspace, the modules only installed for the virtualenv cannot be found, and my pythonPath is missing from the list of the suggestions for python interpreters.

After looking into the source code of this extension I've got the reason. In src/client/interpreter/locators/index.ts, all the folders in a workspace would share the same object of PythonInterpreterLocatorService, or at least the same serviceContainer. Thus in getLocators, the locators returned for every folder are the same batch of objects. What makes it worse is that the locator for handling the user defined pythonPath, i.e. the CurrentPathService, is a cacheable one, so it will not carry out the search several times for different settings of each folder, but simply store the result for the first folder and make no further searches.

As for my case, I didn't set the pythonPath for my folder for vue.js, which is the first folder in my workspace. As a result, the search for the interpreter based on my settings in the second folder can never come into effect. As a workaround, I changed the order of the two folders in my workspace and now it works as expected. However, if there were several folders in a workspace using different pythonPath, such a workaround would not exist.

VS Code Info

VS Code version: Code 1.20.0 (c63189d, 2018-02-07T17:10:15.949Z)
OS version: Linux x64 4.13.0-32-generic

Reproduces only with extensions

@bpasero
Copy link
Member

bpasero commented Feb 14, 2018

Reading your description it seems that the issue originates from an extension and not VS Code itself. Thereby I will close this issue and kindly ask you to report this issue against the extension repository.

Most extensions are on GitHub as well so it should be easy to file it against the extension. If you open an extension on the market place, click on the Support link to find out more.

screen shot 2016-05-05 at 12 51 17

Thanks again for your feedback!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants