@@ -19,8 +19,9 @@ import {
19
19
Resource ,
20
20
RefreshStateValue ,
21
21
RefreshState ,
22
+ EnvironmentType ,
22
23
} from './proposedApiTypes' ;
23
- import { PythonEnvInfo , PythonEnvKind , virtualEnvKinds } from './pythonEnvironments/base/info' ;
24
+ import { PythonEnvInfo , PythonEnvKind , PythonEnvType , virtualEnvKinds } from './pythonEnvironments/base/info' ;
24
25
import { getEnvPath } from './pythonEnvironments/base/info/env' ;
25
26
import { IDiscoveryAPI , ProgressReportStage } from './pythonEnvironments/base/locator' ;
26
27
@@ -167,9 +168,9 @@ export function convertCompleteEnvInfo(env: PythonEnvInfo): ResolvedEnvironment
167
168
bitness : convertArch ( env . arch ) ,
168
169
sysPrefix : env . executable . sysPrefix ,
169
170
} ,
170
- environment : virtualEnvKinds . includes ( env . kind )
171
+ environment : env . type
171
172
? {
172
- type : env . kind === PythonEnvKind . Conda ? 'Conda' : 'VirtualEnv' ,
173
+ type : convertEnvType ( env . type ) ,
173
174
name : env . name ,
174
175
folderUri : Uri . file ( env . location ) ,
175
176
workspaceFolder : env . searchLocation ,
@@ -181,6 +182,16 @@ export function convertCompleteEnvInfo(env: PythonEnvInfo): ResolvedEnvironment
181
182
return resolvedEnv ;
182
183
}
183
184
185
+ function convertEnvType ( envType : PythonEnvType ) : EnvironmentType {
186
+ if ( envType === PythonEnvType . Conda ) {
187
+ return 'Conda' ;
188
+ }
189
+ if ( envType === PythonEnvType . Virtual ) {
190
+ return 'VirtualEnv' ;
191
+ }
192
+ return 'Unknown' ;
193
+ }
194
+
184
195
function convertEnvInfoAndGetReference ( env : PythonEnvInfo ) : Environment {
185
196
const convertedEnv = convertCompleteEnvInfo ( env ) as Environment ;
186
197
if ( convertedEnv . executable . sysPrefix === '' ) {
0 commit comments