@@ -437,12 +437,15 @@ export class Commands {
437
437
if ( ! baseUrl ) {
438
438
throw new Error ( "You are not logged in" ) ;
439
439
}
440
+ if ( treeItem . primaryAgentName === undefined ) {
441
+ return ;
442
+ }
440
443
await openWorkspace (
441
444
baseUrl ,
442
445
treeItem . workspaceOwner ,
443
446
treeItem . workspaceName ,
444
- treeItem . workspaceAgent ,
445
- treeItem . workspaceFolderPath ,
447
+ treeItem . primaryAgentName ,
448
+ treeItem . primaryAgentFolderPath ,
446
449
true ,
447
450
) ;
448
451
} else {
@@ -525,6 +528,8 @@ export class Commands {
525
528
let folderPath : string | undefined ;
526
529
let openRecent : boolean | undefined ;
527
530
531
+ let workspace : Workspace | undefined ;
532
+
528
533
const baseUrl = this . restClient . getAxiosInstance ( ) . defaults . baseURL ;
529
534
if ( ! baseUrl ) {
530
535
throw new Error ( "You are not logged in" ) ;
@@ -571,7 +576,7 @@ export class Commands {
571
576
} ) ;
572
577
} ) ;
573
578
quickPick . show ( ) ;
574
- const workspace = await new Promise < Workspace | undefined > ( ( resolve ) => {
579
+ workspace = await new Promise < Workspace | undefined > ( ( resolve ) => {
575
580
quickPick . onDidHide ( ( ) => {
576
581
resolve ( undefined ) ;
577
582
} ) ;
@@ -590,20 +595,31 @@ export class Commands {
590
595
}
591
596
workspaceOwner = workspace . owner_name ;
592
597
workspaceName = workspace . name ;
598
+ } else {
599
+ workspaceOwner = args [ 0 ] as string ;
600
+ workspaceName = args [ 1 ] as string ;
601
+ workspaceAgent = args [ 2 ] as string | undefined ;
602
+ folderPath = args [ 3 ] as string | undefined ;
603
+ openRecent = args [ 4 ] as boolean | undefined ;
604
+ }
605
+
606
+ if ( ! workspaceAgent ) {
607
+ if ( workspace === undefined ) {
608
+ workspace = await this . restClient . getWorkspaceByOwnerAndName (
609
+ workspaceOwner ,
610
+ workspaceName ,
611
+ ) ;
612
+ }
593
613
594
614
const agent = await this . maybeAskAgent ( workspace ) ;
595
615
if ( ! agent ) {
596
616
// User declined to pick an agent.
597
617
return ;
598
618
}
599
- folderPath = agent . expanded_directory ;
619
+ if ( ! folderPath ) {
620
+ folderPath = agent . expanded_directory ;
621
+ }
600
622
workspaceAgent = agent . name ;
601
- } else {
602
- workspaceOwner = args [ 0 ] as string ;
603
- workspaceName = args [ 1 ] as string ;
604
- workspaceAgent = args [ 2 ] as string | undefined ;
605
- folderPath = args [ 3 ] as string | undefined ;
606
- openRecent = args [ 4 ] as boolean | undefined ;
607
623
}
608
624
609
625
await openWorkspace (
@@ -679,7 +695,7 @@ async function openWorkspace(
679
695
baseUrl : string ,
680
696
workspaceOwner : string ,
681
697
workspaceName : string ,
682
- workspaceAgent : string | undefined ,
698
+ workspaceAgent : string ,
683
699
folderPath : string | undefined ,
684
700
openRecent : boolean | undefined ,
685
701
) {
0 commit comments