Problem
In poetryUtils.ts, the fallback for Poetry's virtualenvs path uses ~/.cache/pypoetry/virtualenvs on all platforms, but Windows has a different default location.
Current Code
// poetryUtils.ts L169-172
const home = getUserHomeDir();
if (home) {
poetryVirtualenvsPath = path.join(home, '.cache', 'pypoetry', 'virtualenvs');
}
Issue
Poetry uses platform-specific default locations:
- Linux:
~/.cache/pypoetry/virtualenvs ✅
- macOS:
~/Library/Caches/pypoetry/virtualenvs
- Windows:
%LOCALAPPDATA%\pypoetry\Cache\virtualenvs or %APPDATA%\pypoetry\Cache\virtualenvs
The current code hardcodes the Linux path for all platforms, causing Poetry environments to not be discovered on Windows.
PET Server Reference
The PET server correctly handles this via Platformdirs in pet-poetry/src/config.rs:
let default_cache_dir = Platformdirs::new(_APP_NAME.into(), false).user_cache_path();
Suggested Fix
Use platform-specific paths:
function getDefaultVirtualenvsPath(): string | undefined {
const home = getUserHomeDir();
if (!home) return undefined;
if (isWindows()) {
// Try LOCALAPPDATA first, then APPDATA
const localAppData = process.env.LOCALAPPDATA;
if (localAppData) {
return path.join(localAppData, 'pypoetry', 'Cache', 'virtualenvs');
}
const appData = process.env.APPDATA;
if (appData) {
return path.join(appData, 'pypoetry', 'Cache', 'virtualenvs');
}
} else if (process.platform === 'darwin') {
return path.join(home, 'Library', 'Caches', 'pypoetry', 'virtualenvs');
}
// Linux default
return path.join(home, '.cache', 'pypoetry', 'virtualenvs');
}
Affected File
src/managers/poetry/poetryUtils.ts
Problem
In
poetryUtils.ts, the fallback for Poetry's virtualenvs path uses~/.cache/pypoetry/virtualenvson all platforms, but Windows has a different default location.Current Code
Issue
Poetry uses platform-specific default locations:
~/.cache/pypoetry/virtualenvs✅~/Library/Caches/pypoetry/virtualenvs%LOCALAPPDATA%\pypoetry\Cache\virtualenvsor%APPDATA%\pypoetry\Cache\virtualenvsThe current code hardcodes the Linux path for all platforms, causing Poetry environments to not be discovered on Windows.
PET Server Reference
The PET server correctly handles this via
Platformdirsinpet-poetry/src/config.rs:Suggested Fix
Use platform-specific paths:
Affected File
src/managers/poetry/poetryUtils.ts