You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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.
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. ThepythonPath
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 mypythonPath
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 ofPythonInterpreterLocatorService
, or at least the sameserviceContainer
. Thus ingetLocators
, the locators returned for every folder are the same batch of objects. What makes it worse is that the locator for handling the user definedpythonPath
, i.e. theCurrentPathService
, 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 differentpythonPath
, 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
The text was updated successfully, but these errors were encountered: