@@ -8,7 +8,7 @@ import { PythonProjectApi } from '../../api';
8
8
import { ENVS_EXTENSION_ID , PYTHON_EXTENSION_ID } from '../../common/constants' ;
9
9
import { getExtension } from '../../common/extension.apis' ;
10
10
import { traceVerbose } from '../../common/logging' ;
11
- import { getUserHomeDir , untildify } from '../../common/utils/pathUtils' ;
11
+ import { untildify } from '../../common/utils/pathUtils' ;
12
12
import { isWindows } from '../../common/utils/platformUtils' ;
13
13
import { createRunningWorkerPool , WorkerPool } from '../../common/utils/workerPool' ;
14
14
import { getConfiguration } from '../../common/workspace.apis' ;
@@ -184,15 +184,22 @@ class NativePythonFinderImpl implements NativePythonFinder {
184
184
}
185
185
186
186
private getRefreshOptions ( options ?: NativePythonEnvironmentKind | Uri [ ] ) : RefreshOptions | undefined {
187
+ // settings on where else to search
188
+ const venvFolders = getPythonSettingAndUntildify < string [ ] > ( 'venvFolders' ) ?? [ ] ;
187
189
if ( options ) {
188
190
if ( typeof options === 'string' ) {
191
+ // kind
189
192
return { searchKind : options } ;
190
193
}
191
194
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 } ;
193
198
}
199
+ } else {
200
+ // if no options, then search venvFolders
201
+ return { searchPaths : venvFolders } ;
194
202
}
195
- return undefined ;
196
203
}
197
204
198
205
private start ( ) : rpc . MessageConnection {
@@ -355,10 +362,9 @@ function getCustomVirtualEnvDirs(): string[] {
355
362
venvDirs . push ( untildify ( venvPath ) ) ;
356
363
}
357
364
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
+ } ) ;
362
368
return Array . from ( new Set ( venvDirs ) ) ;
363
369
}
364
370
0 commit comments