@@ -303,6 +303,35 @@ export async function workspaceSetupStandard(context: vscode.ExtensionContext, w
303
303
return true ;
304
304
}
305
305
306
+ /**
307
+ * Handle external installation configuration and setup
308
+ */
309
+ async function handleExternalInstallation (
310
+ context : vscode . ExtensionContext ,
311
+ wsConfig : WorkspaceConfig ,
312
+ globalConfig : GlobalConfig ,
313
+ westConfigResult : WestConfigResult
314
+ ) : Promise < boolean > {
315
+ const externalPath = westConfigResult . externalInstallPath ! ;
316
+ const needsSetup = westConfigResult . externalInstallNeedsSetup ;
317
+ output . appendLine ( `[SETUP] Using external installation: ${ externalPath } (needsSetup=${ needsSetup } )` ) ;
318
+
319
+ await setSetupState ( context , wsConfig , globalConfig , externalPath ) ;
320
+
321
+ if ( needsSetup ) {
322
+ const extWestSelection = await westSelector ( context , wsConfig ) ;
323
+ if ( ! extWestSelection || extWestSelection . failed ) {
324
+ vscode . window . showErrorMessage ( "External installation configuration cancelled or failed." ) ;
325
+ return false ;
326
+ }
327
+ postWorkspaceSetup ( context , wsConfig , globalConfig , externalPath , extWestSelection ) ;
328
+ } else {
329
+ vscode . window . showInformationMessage ( `Workspace linked to external Zephyr installation at: ${ externalPath } ` ) ;
330
+ }
331
+
332
+ return true ;
333
+ }
334
+
306
335
export async function workspaceSetupFromCurrentDirectory ( context : vscode . ExtensionContext , wsConfig : WorkspaceConfig , globalConfig : GlobalConfig , giveExternalInstallOption : boolean , installDir ?: string ) {
307
336
// Clear all context flags at start
308
337
await clearWorkspaceSetupContextFlags ( context , wsConfig ) ;
@@ -317,7 +346,6 @@ export async function workspaceSetupFromCurrentDirectory(context: vscode.Extensi
317
346
return false ;
318
347
}
319
348
320
-
321
349
output . show ( ) ;
322
350
output . appendLine (
323
351
`[SETUP] Setting up current directory as Zephyr IDE workspace: ${ installDir } `
@@ -348,33 +376,12 @@ export async function workspaceSetupFromCurrentDirectory(context: vscode.Extensi
348
376
349
377
// Handle external installation case
350
378
if ( westConfigResult . useExternalInstallation ) {
351
- const externalPath = westConfigResult . externalInstallPath ! ;
352
- const needsSetup = westConfigResult . externalInstallNeedsSetup ;
353
- output . appendLine ( `[SETUP] Using external installation: ${ externalPath } (needsSetup=${ needsSetup } )` ) ;
354
-
355
- if ( needsSetup ) {
356
- await setSetupState ( context , wsConfig , globalConfig , externalPath ) ;
357
- const extWestSelection = await westSelector ( context , wsConfig ) ;
358
- if ( ! extWestSelection || extWestSelection . failed ) {
359
- vscode . window . showErrorMessage ( "External installation configuration cancelled or failed." ) ;
360
- return false ;
361
- }
362
- postWorkspaceSetup ( context , wsConfig , globalConfig , externalPath , extWestSelection ) ;
363
- return true ;
364
- } else {
365
- await setSetupState ( context , wsConfig , globalConfig , externalPath ) ;
366
- vscode . window . showInformationMessage ( `Workspace linked to external Zephyr installation at: ${ externalPath } ` ) ;
367
- return true ;
368
- }
379
+ return await handleExternalInstallation ( context , wsConfig , globalConfig , westConfigResult ) ;
369
380
}
370
381
371
- // Use the westSelection prepared by westConfig
372
- const westSelection = westConfigResult . westSelection ;
373
-
382
+ // Handle local workspace setup
374
383
await setSetupState ( context , wsConfig , globalConfig , installDir ) ;
375
-
376
- // Run post-setup process
377
- postWorkspaceSetup ( context , wsConfig , globalConfig , installDir , westSelection ) ;
384
+ postWorkspaceSetup ( context , wsConfig , globalConfig , installDir , westConfigResult . westSelection ) ;
378
385
return true ;
379
386
}
380
387
0 commit comments