@@ -620,25 +620,29 @@ export class Commands {
620
620
*
621
621
* Throw if not logged into a deployment.
622
622
*/
623
- public async openDevContainer ( ...args : string [ ] ) : Promise < void > {
623
+ public async openDevContainer (
624
+ workspaceOwner : string ,
625
+ workspaceName : string ,
626
+ workspaceAgent : string ,
627
+ devContainerName : string ,
628
+ devContainerFolder : string ,
629
+ localWorkspaceFolder : string = "" ,
630
+ localConfigFile : string = "" ,
631
+ ) : Promise < void > {
624
632
const baseUrl = this . restClient . getAxiosInstance ( ) . defaults . baseURL ;
625
633
if ( ! baseUrl ) {
626
634
throw new Error ( "You are not logged in" ) ;
627
635
}
628
636
629
- const workspaceOwner = args [ 0 ] as string ;
630
- const workspaceName = args [ 1 ] as string ;
631
- const workspaceAgent = args [ 2 ] as string ;
632
- const devContainerName = args [ 3 ] as string ;
633
- const devContainerFolder = args [ 4 ] as string ;
634
-
635
637
await openDevContainer (
636
638
baseUrl ,
637
639
workspaceOwner ,
638
640
workspaceName ,
639
641
workspaceAgent ,
640
642
devContainerName ,
641
643
devContainerFolder ,
644
+ localWorkspaceFolder ,
645
+ localConfigFile ,
642
646
) ;
643
647
}
644
648
@@ -751,6 +755,8 @@ async function openDevContainer(
751
755
workspaceAgent : string ,
752
756
devContainerName : string ,
753
757
devContainerFolder : string ,
758
+ localWorkspaceFolder : string = "" ,
759
+ localConfigFile : string = "" ,
754
760
) {
755
761
const remoteAuthority = toRemoteAuthority (
756
762
baseUrl ,
@@ -759,11 +765,26 @@ async function openDevContainer(
759
765
workspaceAgent ,
760
766
) ;
761
767
768
+ const hostPath = localWorkspaceFolder ? localWorkspaceFolder : undefined ;
769
+ const configFile =
770
+ hostPath && localConfigFile
771
+ ? {
772
+ path : localConfigFile ,
773
+ scheme : "vscode-fileHost" ,
774
+ }
775
+ : undefined ;
762
776
const devContainer = Buffer . from (
763
- JSON . stringify ( { containerName : devContainerName } ) ,
777
+ JSON . stringify ( {
778
+ containerName : devContainerName ,
779
+ hostPath,
780
+ configFile,
781
+ localDocker : false ,
782
+ } ) ,
764
783
"utf-8" ,
765
784
) . toString ( "hex" ) ;
766
- const devContainerAuthority = `attached-container+${ devContainer } @${ remoteAuthority } ` ;
785
+
786
+ const type = localWorkspaceFolder ? "dev-container" : "attached-container" ;
787
+ const devContainerAuthority = `${ type } +${ devContainer } @${ remoteAuthority } ` ;
767
788
768
789
let newWindow = true ;
769
790
if ( ! vscode . workspace . workspaceFolders ?. length ) {
0 commit comments