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

Do not filter using scheme when filtering environments #21862

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/client/common/utils/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function isUri(resource?: Uri | any): resource is Uri {
/**
* Create a filter func that determine if the given URI and candidate match.
*
* The scheme must match, as well as path.
* Only compares path.
*
* @param checkParent - if `true`, match if the candidate is rooted under `uri`
* or if the candidate matches `uri` exactly.
Expand All @@ -80,9 +80,8 @@ export function getURIFilter(
}
const uriRoot = `${uriPath}/`;
function filter(candidate: Uri): boolean {
if (candidate.scheme !== uri.scheme) {
return false;
}
// Do not compare schemes as it is sometimes not available, in
// which case file is assumed as scheme.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring above on line 63 probably needs an update?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

let candidatePath = candidate.path;
while (candidatePath.endsWith('/')) {
candidatePath = candidatePath.slice(0, -1);
Expand Down
8 changes: 7 additions & 1 deletion src/client/pythonEnvironments/base/info/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ export function areEnvsDeepEqual(env1: PythonEnvInfo, env2: PythonEnvInfo): bool
env2Clone.source = env2Clone.source.sort();
const searchLocation1 = env1.searchLocation?.fsPath ?? '';
const searchLocation2 = env2.searchLocation?.fsPath ?? '';
return isEqual(env1Clone, env2Clone) && arePathsSame(searchLocation1, searchLocation2);
const searchLocation1Scheme = env1.searchLocation?.scheme ?? '';
const searchLocation2Scheme = env2.searchLocation?.scheme ?? '';
return (
isEqual(env1Clone, env2Clone) &&
arePathsSame(searchLocation1, searchLocation2) &&
searchLocation1Scheme === searchLocation2Scheme
);
}

/**
Expand Down