Skip to content

Commit

Permalink
Do not filter using scheme when filtering environments (#21862)
Browse files Browse the repository at this point in the history
For #21825

On codespaces, it was leading to workspace environments not being
displayed, which could mess up auto-selection.
  • Loading branch information
Kartik Raj committed Aug 22, 2023
1 parent cfbf1f3 commit 15bb974
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
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.
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

0 comments on commit 15bb974

Please sign in to comment.