@@ -64,21 +64,20 @@ export async function activate(api: IDiscoveryAPI, ext: ExtensionState): Promise
64
64
* extension activation on the "refresh trigger".
65
65
*/
66
66
const folders = vscode . workspace . workspaceFolders ;
67
- const wasTriggered = getGlobalStorage < boolean > ( ext . context , 'PYTHON_WAS_DISCOVERY_TRIGGERED' , false ) ;
68
- if ( ! wasTriggered . get ( ) ) {
67
+ // Trigger discovery if environment cache is empty.
68
+ const wasTriggered = getGlobalStorage < PythonEnvInfo [ ] > ( ext . context , 'PYTHON_ENV_INFO_CACHE' , [ ] ) . get ( ) . length > 0 ;
69
+ if ( ! wasTriggered ) {
69
70
api . triggerRefresh ( ) . ignoreErrors ( ) ;
70
- wasTriggered . set ( true ) . then ( ( ) => {
71
- folders ?. forEach ( async ( folder ) => {
72
- const wasTriggeredForFolder = getGlobalStorage < boolean > (
73
- ext . context ,
74
- `PYTHON_WAS_DISCOVERY_TRIGGERED_${ normCasePath ( folder . uri . fsPath ) } ` ,
75
- false ,
76
- ) ;
77
- await wasTriggeredForFolder . set ( true ) ;
78
- } ) ;
71
+ folders ?. forEach ( async ( folder ) => {
72
+ const wasTriggeredForFolder = getGlobalStorage < boolean > (
73
+ ext . context ,
74
+ `PYTHON_WAS_DISCOVERY_TRIGGERED_${ normCasePath ( folder . uri . fsPath ) } ` ,
75
+ false ,
76
+ ) ;
77
+ await wasTriggeredForFolder . set ( true ) ;
79
78
} ) ;
80
79
} else {
81
- // Figure out which workspace folders need to be activated.
80
+ // Figure out which workspace folders need to be activated if any .
82
81
folders ?. forEach ( async ( folder ) => {
83
82
const wasTriggeredForFolder = getGlobalStorage < boolean > (
84
83
ext . context ,
0 commit comments