@@ -29,10 +29,13 @@ function getSearchPaths(): Promise<string[]> {
2929 localAppData , appData ,
3030 process . env [ 'SystemDrive' ] ] ;
3131 if ( appData ) {
32- lookupParentDirectories . push ( path . join ( localAppData , 'Programs' ) )
32+ lookupParentDirectories . push ( path . join ( localAppData , 'Programs' ) ) ;
3333 }
3434 if ( localAppData ) {
35- lookupParentDirectories . push ( path . join ( appData , 'Programs' ) )
35+ lookupParentDirectories . push ( path . join ( appData , 'Programs' ) ) ;
36+ }
37+ if ( settings . PythonSettings . getInstance ( ) . venvPath ) {
38+ lookupParentDirectories . push ( settings . PythonSettings . getInstance ( ) . venvPath ) ;
3639 }
3740 const dirPromises = lookupParentDirectories . map ( rootDir => {
3841 if ( ! rootDir ) {
@@ -64,12 +67,15 @@ function getSearchPaths(): Promise<string[]> {
6467 return validPathsCollection . reduce ( ( previousValue , currentValue ) => previousValue . concat ( currentValue ) , [ ] ) ;
6568 } ) ;
6669 } else {
67- const paths = [ '/usr/local/bin' , '/usr/bin' , '/bin' , '/usr/sbin' , '/sbin' , '/usr/local/sbin' ] ;
70+ const paths = [ '/usr/local/bin' , '/usr/bin' , '/bin' , '/usr/sbin' , '/sbin' , '/usr/local/sbin' , '/Envs' , '/.virtualenvs' , '/.pyenv' ] ;
6871 // Add support for paths such as /Users/xxx/anaconda/bin
6972 if ( process . env [ 'HOME' ] ) {
7073 paths . push ( path . join ( process . env [ 'HOME' ] , 'anaconda' , 'bin' ) ) ;
7174 paths . push ( path . join ( process . env [ 'HOME' ] , 'python' , 'bin' ) ) ;
7275 }
76+ if ( settings . PythonSettings . getInstance ( ) . venvPath ) {
77+ paths . push ( settings . PythonSettings . getInstance ( ) . venvPath ) ;
78+ }
7379 return Promise . resolve ( paths ) ;
7480 }
7581}
@@ -241,7 +247,7 @@ function presentQuickPickOfSuggestedPythonPaths() {
241247}
242248
243249function setInterpreter ( ) {
244- if ( typeof vscode . workspace . rootPath !== 'string' ) {
250+ if ( typeof vscode . workspace . rootPath !== 'string' ) {
245251 return vscode . window . showErrorMessage ( 'Please open a workspace to select the Python Interpreter' ) ;
246252 }
247253 presentQuickPickOfSuggestedPythonPaths ( ) ;
0 commit comments