Problem
Per project learnings documented in .github/instructions/generic.instructions.md:
path.normalize() vs path.resolve(): On Windows, path.normalize('\test') keeps it as \test, but path.resolve('\test') adds the current drive → C:\test. When comparing paths, use path.resolve() on BOTH sides or they won't match.
Multiple manager implementations use path.normalize() for path comparisons, which can cause matching failures on Windows.
Affected Code
pyenvManager.ts L259:
private findEnvironmentByPath(fsPath: string): PythonEnvironment | undefined {
const normalized = path.normalize(fsPath);
return this.collection.find((e) => {
const n = path.normalize(e.environmentPath.fsPath);
return n === normalized || path.dirname(n) === normalized || path.dirname(path.dirname(n)) === normalized;
});
}
poetryManager.ts L244:
private findEnvironmentByPath(fsPath: string): PythonEnvironment | undefined {
const normalized = path.normalize(fsPath);
return this.collection.find((e) => {
const n = path.normalize(e.environmentPath.fsPath);
return n === normalized || path.dirname(n) === normalized || path.dirname(path.dirname(n)) === normalized;
});
}
Expected Behavior
Path comparisons should use path.resolve() on both sides to ensure drive letters are properly added on Windows.
Suggested Fix
private findEnvironmentByPath(fsPath: string): PythonEnvironment | undefined {
const normalized = path.resolve(fsPath);
return this.collection.find((e) => {
const n = path.resolve(e.environmentPath.fsPath);
return n === normalized || path.dirname(n) === normalized || path.dirname(path.dirname(n)) === normalized;
});
}
Affected Files
src/managers/pyenv/pyenvManager.ts
src/managers/poetry/poetryManager.ts
- Potentially other files using
path.normalize() for path equality checks
Problem
Per project learnings documented in
.github/instructions/generic.instructions.md:Multiple manager implementations use
path.normalize()for path comparisons, which can cause matching failures on Windows.Affected Code
pyenvManager.ts L259:
poetryManager.ts L244:
Expected Behavior
Path comparisons should use
path.resolve()on both sides to ensure drive letters are properly added on Windows.Suggested Fix
Affected Files
src/managers/pyenv/pyenvManager.tssrc/managers/poetry/poetryManager.tspath.normalize()for path equality checks