Skip to content

Commit

Permalink
Fix for duplication of python envs
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig committed Oct 18, 2024
1 parent fb79afb commit 178aa34
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/client/pythonEnvironments/nativeAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,12 @@ class NativePythonEnvironments implements IDiscoveryAPI, Disposable {
const info = toPythonEnvInfo(native);
if (info) {
const old = this._envs.find((item) => item.executable.filename === info.executable.filename);
if (old && hasChanged(old, info)) {
if (old) {
this._envs = this._envs.filter((item) => item.executable.filename !== info.executable.filename);
this._envs.push(info);
this._onChanged.fire({ type: FileChangeType.Changed, old, new: info, searchLocation });
if (hasChanged(old, info)) {
this._onChanged.fire({ type: FileChangeType.Changed, old, new: info, searchLocation });
}
} else {
this._envs.push(info);
this._onChanged.fire({ type: FileChangeType.Created, new: info, searchLocation });
Expand Down

0 comments on commit 178aa34

Please sign in to comment.