Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 247a047

Browse files
Kartik Rajanthonykim1
Kartik Raj
authored andcommittedSep 12, 2023
Do not filter using scheme when filtering environments (microsoft#21862)
For microsoft#21825 On codespaces, it was leading to workspace environments not being displayed, which could mess up auto-selection.
1 parent 05130e7 commit 247a047

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed
 

‎src/client/common/utils/misc.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function isUri(resource?: Uri | any): resource is Uri {
6060
/**
6161
* Create a filter func that determine if the given URI and candidate match.
6262
*
63-
* The scheme must match, as well as path.
63+
* Only compares path.
6464
*
6565
* @param checkParent - if `true`, match if the candidate is rooted under `uri`
6666
* or if the candidate matches `uri` exactly.
@@ -80,9 +80,8 @@ export function getURIFilter(
8080
}
8181
const uriRoot = `${uriPath}/`;
8282
function filter(candidate: Uri): boolean {
83-
if (candidate.scheme !== uri.scheme) {
84-
return false;
85-
}
83+
// Do not compare schemes as it is sometimes not available, in
84+
// which case file is assumed as scheme.
8685
let candidatePath = candidate.path;
8786
while (candidatePath.endsWith('/')) {
8887
candidatePath = candidatePath.slice(0, -1);

‎src/client/pythonEnvironments/base/info/env.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@ export function areEnvsDeepEqual(env1: PythonEnvInfo, env2: PythonEnvInfo): bool
8787
env2Clone.source = env2Clone.source.sort();
8888
const searchLocation1 = env1.searchLocation?.fsPath ?? '';
8989
const searchLocation2 = env2.searchLocation?.fsPath ?? '';
90-
return isEqual(env1Clone, env2Clone) && arePathsSame(searchLocation1, searchLocation2);
90+
const searchLocation1Scheme = env1.searchLocation?.scheme ?? '';
91+
const searchLocation2Scheme = env2.searchLocation?.scheme ?? '';
92+
return (
93+
isEqual(env1Clone, env2Clone) &&
94+
arePathsSame(searchLocation1, searchLocation2) &&
95+
searchLocation1Scheme === searchLocation2Scheme
96+
);
9197
}
9298

9399
/**

0 commit comments

Comments
 (0)
Please sign in to comment.