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