You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enhance NativePythonFinderImpl with improved logging and configuration comparison (#1149)
## Summary
This PR implements code quality improvements for `
ativePythonFinder.ts` as identified in #1142.
## Changes
### 1. Type Guard for `isNativeEnvInfo()`
Changed return type from `boolean` to `info is NativeEnvInfo` for proper
TypeScript type narrowing.
### 2. Robust Configuration Comparison
Replaced fragile `JSON.stringify()` comparison with a dedicated
`configurationEquals()` method that:
- Compares properties individually
- Uses sorted array comparison to handle order differences
- Avoids issues with undefined value serialization
### 3. Cache Key Collision Prevention
Changed the separator for cache keys from `,` to `\0` (null character)
to prevent collisions with paths containing commas.
### 4. Standardized Logging
Converted `traceVerbose` calls within `NativePythonFinderImpl` to use
`outputChannel.debug()` for consistent instance-level logging. Removed
unused import.
### 5. Graceful Shutdown
Added a graceful shutdown mechanism that closes stdin before killing the
process, giving it 500ms to clean up.
### 6. Documentation
Added explanatory comment for the intentional duplicate `venvFolders`
fetch explaining why it's needed when `searchPaths` may override
`environmentDirectories`.
Fixes#1142
0 commit comments