@@ -8,7 +8,7 @@ import { PythonProjectApi } from '../../api';
88import { ENVS_EXTENSION_ID , PYTHON_EXTENSION_ID } from '../../common/constants' ;
99import { getExtension } from '../../common/extension.apis' ;
1010import { traceVerbose } from '../../common/logging' ;
11- import { getUserHomeDir , untildify } from '../../common/utils/pathUtils' ;
11+ import { untildify } from '../../common/utils/pathUtils' ;
1212import { isWindows } from '../../common/utils/platformUtils' ;
1313import { createRunningWorkerPool , WorkerPool } from '../../common/utils/workerPool' ;
1414import { getConfiguration } from '../../common/workspace.apis' ;
@@ -184,15 +184,22 @@ class NativePythonFinderImpl implements NativePythonFinder {
184184 }
185185
186186 private getRefreshOptions ( options ?: NativePythonEnvironmentKind | Uri [ ] ) : RefreshOptions | undefined {
187+ // settings on where else to search
188+ const venvFolders = getPythonSettingAndUntildify < string [ ] > ( 'venvFolders' ) ?? [ ] ;
187189 if ( options ) {
188190 if ( typeof options === 'string' ) {
191+ // kind
189192 return { searchKind : options } ;
190193 }
191194 if ( Array . isArray ( options ) ) {
192- return { searchPaths : options . map ( ( item ) => item . fsPath ) } ;
195+ const uriSearchPaths = options . map ( ( item ) => item . fsPath ) ;
196+ uriSearchPaths . push ( ...venvFolders ) ;
197+ return { searchPaths : uriSearchPaths } ;
193198 }
199+ } else {
200+ // if no options, then search venvFolders
201+ return { searchPaths : venvFolders } ;
194202 }
195- return undefined ;
196203 }
197204
198205 private start ( ) : rpc . MessageConnection {
@@ -355,10 +362,9 @@ function getCustomVirtualEnvDirs(): string[] {
355362 venvDirs . push ( untildify ( venvPath ) ) ;
356363 }
357364 const venvFolders = getPythonSettingAndUntildify < string [ ] > ( 'venvFolders' ) ?? [ ] ;
358- const homeDir = getUserHomeDir ( ) ;
359- if ( homeDir ) {
360- venvFolders . map ( ( item ) => path . join ( homeDir , item ) ) . forEach ( ( d ) => venvDirs . push ( d ) ) ;
361- }
365+ venvFolders . forEach ( ( item ) => {
366+ venvDirs . push ( item ) ;
367+ } ) ;
362368 return Array . from ( new Set ( venvDirs ) ) ;
363369}
364370
0 commit comments