Sort available environments by assumed usefulness#16559
Sort available environments by assumed usefulness#16559kimadeline merged 15 commits intomicrosoft:mainfrom
Conversation
karthiknadig
left a comment
There was a problem hiding this comment.
Other than the path comparison thing this looks good.
|
|
||
| switch (envType) { | ||
| case EnvironmentType.Venv: { | ||
| if (workspacePath.length > 0 && environment.envPath?.startsWith(workspacePath)) { |
There was a problem hiding this comment.
Paths probably should be normalized before comparing.
There was a problem hiding this comment.
This helper should be useful,
vscode-python/src/client/common/platform/fs-paths.ts
Lines 151 to 158 in 488aaa2
There was a problem hiding this comment.
EnvTypeHeuristic.Local can also be of other types, including Unknown. I think we should be doing the check of whether an env is local prior to checking env types.
There was a problem hiding this comment.
EnvTypeHeuristic.Local can also be of other types, including Unknown. I think we should be doing the check of whether an env is local prior to checking env types.
So from what I understand you are suggesting that any environment path that has the workspace as the parent path should be considered local? How can an environment end up categorized as Unknown again?
I think that if we failed to identify an environment it shouldn't be prioritized it over others.
There was a problem hiding this comment.
you are suggesting that any environment path that has the workspace as the parent path should be considered local?
Yes
How can an environment end up categorized as Unknown again?
If none of our environments type checks matches, a local environment can be classified as Unknown.
But practically speaking it shouldn't happen. So maybe we shouldn't worry about the Unknown case in local envs.
I think that if we failed to identify an environment it shouldn't be prioritized it over others.
Or we can make an exception case as you suggested here.
There was a problem hiding this comment.
Besides Venv and Unknown, which other environment types could possibly be categorized as local?
There was a problem hiding this comment.
Poetry, conda can both have local and global versions.
There was a problem hiding this comment.
Virtualenv, Pipenv can be in there as well. Basically I don't think we should define local envs based on kind.
|
|
||
| switch (envType) { | ||
| case EnvironmentType.Venv: { | ||
| if (workspacePath.length > 0 && environment.envPath?.startsWith(workspacePath)) { |
There was a problem hiding this comment.
EnvTypeHeuristic.Local can also be of other types, including Unknown. I think we should be doing the check of whether an env is local prior to checking env types.
For #16520