@@ -14,15 +14,14 @@ import { traceError, traceInfo } from '../../common/logging';
1414import { getGlobalPersistentState , getWorkspacePersistentState } from '../../common/persistentState' ;
1515import { getUserHomeDir , normalizePath , untildify } from '../../common/utils/pathUtils' ;
1616import { isWindows } from '../../common/utils/platformUtils' ;
17- import { ShellConstants } from '../../features/common/shellConstants' ;
1817import {
1918 isNativeEnvInfo ,
2019 NativeEnvInfo ,
2120 NativeEnvManagerInfo ,
2221 NativePythonEnvironmentKind ,
2322 NativePythonFinder ,
2423} from '../common/nativePythonFinder' ;
25- import { pathForGitBash , shortVersion , sortEnvironments } from '../common/utils' ;
24+ import { shortVersion , sortEnvironments } from '../common/utils' ;
2625
2726async function findPyenv ( ) : Promise < string | undefined > {
2827 try {
@@ -186,15 +185,8 @@ function nativeToPythonEnv(
186185 const shellActivation : Map < string , PythonCommandRunConfiguration [ ] > = new Map ( ) ;
187186 const shellDeactivation : Map < string , PythonCommandRunConfiguration [ ] > = new Map ( ) ;
188187
189- shellActivation . set ( 'unknown' , [ { executable : pyenv , args : [ 'shell' , name ] } ] ) ;
190- shellDeactivation . set ( 'unknown' , [ { executable : pyenv , args : [ 'shell' , '--unset' ] } ] ) ;
191-
192- if ( isWindows ( ) ) {
193- shellActivation . set ( ShellConstants . GITBASH , [ { executable : pathForGitBash ( pyenv ) , args : [ 'shell' , name ] } ] ) ;
194- shellDeactivation . set ( ShellConstants . GITBASH , [
195- { executable : pathForGitBash ( pyenv ) , args : [ 'shell' , '--unset' ] } ,
196- ] ) ;
197- }
188+ shellActivation . set ( 'unknown' , [ { executable : 'pyenv' , args : [ 'shell' , name ] } ] ) ;
189+ shellDeactivation . set ( 'unknown' , [ { executable : 'pyenv' , args : [ 'shell' , '--unset' ] } ] ) ;
198190
199191 const environment : PythonEnvironmentInfo = {
200192 name : name ,
@@ -237,25 +229,23 @@ export async function refreshPyenv(
237229 await setPyenv ( pyenv ) ;
238230 }
239231
240- if ( pyenv ) {
241- const envs = data
242- . filter ( ( e ) => isNativeEnvInfo ( e ) )
243- . map ( ( e ) => e as NativeEnvInfo )
244- . filter ( ( e ) => e . kind === NativePythonEnvironmentKind . pyenv ) ;
245- const collection : PythonEnvironment [ ] = [ ] ;
232+ const envs = data
233+ . filter ( ( e ) => isNativeEnvInfo ( e ) )
234+ . map ( ( e ) => e as NativeEnvInfo )
235+ . filter ( ( e ) => e . kind === NativePythonEnvironmentKind . pyenv ) ;
246236
247- envs . forEach ( ( e ) => {
237+ const collection : PythonEnvironment [ ] = [ ] ;
238+
239+ envs . forEach ( ( e ) => {
240+ if ( pyenv ) {
248241 const environment = nativeToPythonEnv ( e , api , manager , pyenv ) ;
249242 if ( environment ) {
250243 collection . push ( environment ) ;
251244 }
252- } ) ;
253-
254- return sortEnvironments ( collection ) ;
255- }
245+ }
246+ } ) ;
256247
257- traceError ( 'Pyenv not found' ) ;
258- return [ ] ;
248+ return sortEnvironments ( collection ) ;
259249}
260250
261251export async function resolvePyenvPath (
0 commit comments