@@ -5,7 +5,7 @@ import { cloneDeep } from 'lodash';
5
5
import { Event , EventEmitter } from 'vscode' ;
6
6
import { identifyEnvironment } from '../../../common/environmentIdentifier' ;
7
7
import { IEnvironmentInfoService } from '../../info/environmentInfoService' ;
8
- import { PythonEnvInfo } from '../../info' ;
8
+ import { PythonEnvInfo , PythonEnvKind } from '../../info' ;
9
9
import { getEnvPath , setEnvDisplayString } from '../../info/env' ;
10
10
import { InterpreterInformation } from '../../info/interpreter' ;
11
11
import {
@@ -63,6 +63,7 @@ export class PythonEnvsResolver implements IResolvingLocator {
63
63
iterator : IPythonEnvsIterator < BasicEnvInfo > ,
64
64
didUpdate : EventEmitter < PythonEnvUpdatedEvent | ProgressNotificationEvent > ,
65
65
) : IPythonEnvsIterator {
66
+ const environmentKinds = new Map < string , PythonEnvKind > ( ) ;
66
67
const state = {
67
68
done : false ,
68
69
pending : 0 ,
@@ -86,6 +87,7 @@ export class PythonEnvsResolver implements IResolvingLocator {
86
87
) ;
87
88
} else if ( seen [ event . index ] !== undefined ) {
88
89
const old = seen [ event . index ] ;
90
+ await setKind ( event . update , environmentKinds ) ;
89
91
seen [ event . index ] = await resolveBasicEnv ( event . update , true ) ;
90
92
didUpdate . fire ( { old, index : event . index , update : seen [ event . index ] } ) ;
91
93
this . resolveInBackground ( event . index , state , didUpdate , seen ) . ignoreErrors ( ) ;
@@ -103,6 +105,7 @@ export class PythonEnvsResolver implements IResolvingLocator {
103
105
let result = await iterator . next ( ) ;
104
106
while ( ! result . done ) {
105
107
// Use cache from the current refresh where possible.
108
+ await setKind ( result . value , environmentKinds ) ;
106
109
const currEnv = await resolveBasicEnv ( result . value , true ) ;
107
110
seen . push ( currEnv ) ;
108
111
yield currEnv ;
@@ -139,6 +142,16 @@ export class PythonEnvsResolver implements IResolvingLocator {
139
142
}
140
143
}
141
144
145
+ async function setKind ( env : BasicEnvInfo , environmentKinds : Map < string , PythonEnvKind > ) {
146
+ const { path } = getEnvPath ( env . executablePath , env . envPath ) ;
147
+ let kind = environmentKinds . get ( path ) ;
148
+ if ( ! kind ) {
149
+ kind = await identifyEnvironment ( path ) ;
150
+ environmentKinds . set ( path , kind ) ;
151
+ }
152
+ env . kind = kind ;
153
+ }
154
+
142
155
/**
143
156
* When all info from incoming iterator has been received and all background calls finishes, notify that we're done
144
157
* @param state Carries the current state of progress
0 commit comments