-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PR
Description
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\virtualenvsor%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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bugneeds PR