Problem
The PET (Python Environment Tools) server now reports broken/invalid environments with an error field in the PythonEnvironment struct (e.g., detecting broken symlinks, missing Python executables). However, the VS Code extension doesn't receive or display this information to users.
Current Behavior
-
Missing error field in NativeEnvInfo interface (nativePythonFinder.ts):
export interface NativeEnvInfo {
displayName?: string;
name?: string;
executable?: string;
kind?: NativePythonEnvironmentKind;
version?: string;
prefix?: string;
manager?: NativeEnvManagerInfo;
project?: string;
arch?: 'x64' | 'x86';
symlinks?: string[];
// Missing: error?: string;
}
-
Broken environments silently skipped (venvUtils.ts):
for (const e of envs) {
if (!(e.prefix && e.executable && e.version)) {
log.warn(`Invalid venv environment: ${JSON.stringify(e)}`);
continue; // Silently skips - users never see broken envs
}
Impact
- Users cannot see or diagnose broken virtual environments
- Environments with broken symlinks (e.g., base Python was uninstalled) silently disappear from the list
- No actionable feedback to help users fix the issue
Expected Behavior
- Add
error?: string field to NativeEnvInfo interface
- Display broken environments in the Environments view with a warning indicator
- Show the error message in tooltip/details so users understand what's wrong
- Allow users to remove/recreate broken environments
Proposed UI
- Show broken environments with a warning icon (⚠️) or dimmed appearance
- Tooltip should show: "This environment has issues: {error message}"
- Right-click menu could offer "Remove broken environment" option
Technical Changes Needed
- Add
error field to NativeEnvInfo interface
- Update
findVirtualEnvironments() to include environments with errors
- Update
PythonEnvironmentInfo API type if needed
- Update environment tree view to handle error states
- Add appropriate UI styling for broken environments
Related
- PET already detects and reports these errors from
try_environment_from_venv_dir() in pet-venv/src/lib.rs
Problem
The PET (Python Environment Tools) server now reports broken/invalid environments with an
errorfield in thePythonEnvironmentstruct (e.g., detecting broken symlinks, missing Python executables). However, the VS Code extension doesn't receive or display this information to users.Current Behavior
Missing
errorfield inNativeEnvInfointerface (nativePythonFinder.ts):Broken environments silently skipped (venvUtils.ts):
Impact
Expected Behavior
error?: stringfield toNativeEnvInfointerfaceProposed UI
Technical Changes Needed
errorfield toNativeEnvInfointerfacefindVirtualEnvironments()to include environments with errorsPythonEnvironmentInfoAPI type if neededRelated
try_environment_from_venv_dir()inpet-venv/src/lib.rs