-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add multiroot-workspace variable scoping for python.defaultInterpreterPath
#18650
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
Comments
One of the projects I work with is a microservices monorepo But this really isn't the best and is bound to have issues as soon as there's version conflicts between services. |
Note https://code.visualstudio.com/docs/editor/variables-reference#_variables-scoped-per-workspace-folder is currently only supported in @OmeGak In this usecase |
Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue. |
Thanks for your answer @karrtikr!
The
That is one way to look at it but in my use case
This is certainly another workaround. It's still more fragile than being able to use "folders": [
{
"name": "python-a",
"path": "projects/my-python-project/python-a"
}
],
"settings": {
"python.defaultInterpreterPath": "projects/my-python-project/python-a/.venv/bin/python"
} Versus: "folders": [
{
"name": "python-a",
"path": "projects/my-python-project/python-a"
}
],
"settings": {
"python.defaultInterpreterPath": "${workspaceFolder:python-a}/.venv/bin/python"
} |
Thank you to everyone who upvoted this issue! Since the community showed interest in this feature request we will leave this issue open as something to consider implementing at some point in the future. We do encourage people to continue 👍 the first/opening comment as it helps us prioritize our work based on what the community seems to want the most. |
@OmeGak Apologies for the delayed response and thanks for the insight!
Two workspace folders can share the same base name as well where this does not work in its own right. However https://code.visualstudio.com/docs/editor/variables-reference#_variables-scoped-per-workspace-folder also documents this, so maybe it's not considered such a practical scenario. We'll still probably go with
Supporting such system variables in settings.json were being a problem for LSP which is probably why they aren't supported by VSCode, IIRC. I'll see if I can find any links. |
@OmeGak The reason with this as a
What is the right resolution here for
The issue boils down to, settings are hierarchical so substitutions are not straight forward. What works is in each folder had a And you would not need to have variables that require substitution there, at least variables like ${workspaceFolder}. |
It's currently not possible to use multiroot-workspace variable scoping to configure
python.defaultInterpreterPath
, as @kimadeline mentioned in #18207 (comment).My use case is the following. I have multiple python projects in my workspace but I want them all to use the same virtualenv, existing under one of the workspace folders. The tree structure looks like this:
To make it work with
python.defaultInterpreterPath
I need to configure it like this in the workspace file:This is fragile, as it will break if
python-b/
workspace folder changes its absolute path. With multiroot-workspace variable scoping it would be possible to express this dependency more robustly like this:The text was updated successfully, but these errors were encountered: