@@ -300,39 +300,54 @@ export class MirrordConfigManager {
300
300
. withOpenFileAction ( this . active )
301
301
. withDisableAction ( "promptUsingActiveConfig" )
302
302
. info ( ) ;
303
+
303
304
return this . active ;
304
305
} else if ( config . env ?. [ "MIRRORD_CONFIG_FILE" ] ) {
305
306
// Get the config path from the env var.
306
- return vscode . Uri . parse ( `file://${ config . env ?. [ "MIRRORD_CONFIG_FILE" ] } ` , true ) ;
307
+ const configFromEnv = vscode . Uri . parse ( `file://${ config . env ?. [ "MIRRORD_CONFIG_FILE" ] } ` , true ) ;
308
+
309
+ new NotificationBuilder ( )
310
+ . withMessage ( "using active mirrord configuration" )
311
+ . withOpenFileAction ( configFromEnv )
312
+ . withDisableAction ( "promptUsingActiveConfig" )
313
+ . info ( ) ;
314
+
315
+ return configFromEnv ;
316
+
307
317
} else if ( folder ) {
308
- let predefinedConfig = await MirrordConfigManager . getDefaultConfig ( folder ) ;
309
- if ( predefinedConfig ) {
318
+ const configFromMirrordFolder = await MirrordConfigManager . getDefaultConfig ( folder ) ;
319
+
320
+ if ( configFromMirrordFolder ) {
310
321
new NotificationBuilder ( )
311
- . withMessage ( "using a default mirrord config " )
312
- . withOpenFileAction ( predefinedConfig )
322
+ . withMessage ( "using config from . mirrord" )
323
+ . withOpenFileAction ( configFromMirrordFolder )
313
324
. withDisableAction ( "promptUsingDefaultConfig" )
314
- . warning ( ) ;
315
- return predefinedConfig ;
325
+ . info ( ) ;
326
+
327
+ return configFromMirrordFolder ;
316
328
} else {
317
329
return null ;
318
330
}
319
331
} else {
320
- folder = vscode . workspace . workspaceFolders ?. [ 0 ] ;
321
- if ( ! folder ) {
332
+ const configFromWorkspace = vscode . workspace . workspaceFolders ?. [ 0 ] ;
333
+ if ( configFromWorkspace ) {
334
+ const predefinedConfig = await MirrordConfigManager . getDefaultConfig ( configFromWorkspace ) ;
335
+
336
+ if ( predefinedConfig ) {
337
+ new NotificationBuilder ( )
338
+ . withMessage ( `using a default mirrord config from folder ${ configFromWorkspace . name } ` )
339
+ . withOpenFileAction ( predefinedConfig )
340
+ . withDisableAction ( "promptUsingDefaultConfig" )
341
+ . warning ( ) ;
342
+
343
+ return predefinedConfig ;
344
+ } else {
345
+ return null ;
346
+ }
347
+ } else {
322
348
throw new Error ( "mirrord requires an open folder in the workspace" ) ;
323
349
}
324
350
325
- let predefinedConfig = await MirrordConfigManager . getDefaultConfig ( folder ) ;
326
- if ( predefinedConfig ) {
327
- new NotificationBuilder ( )
328
- . withMessage ( `using a default mirrord config from folder ${ folder . name } ` )
329
- . withOpenFileAction ( predefinedConfig )
330
- . withDisableAction ( "promptUsingDefaultConfig" )
331
- . warning ( ) ;
332
- return predefinedConfig ;
333
- } else {
334
- return null ;
335
- }
336
351
}
337
352
}
338
353
}
0 commit comments