Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite0adfb8

Browse files
authored
fix: improveopenDevContainer support with local workspace folder (#544)
1 parent0c73c83 commite0adfb8

File tree

3 files changed

+43
-9
lines changed

3 files changed

+43
-9
lines changed

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
##Unreleased
44

5+
- Update`/openDevContainer` to support all dev container features when hostPath
6+
and configFile are provided.
7+
58
##[v1.9.2](https://github.com/coder/vscode-coder/releases/tag/v1.9.2) 2025-06-25
69

710
###Fixed

‎src/commands.ts‎

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -620,25 +620,29 @@ export class Commands {
620620
*
621621
* Throw if not logged into a deployment.
622622
*/
623-
publicasyncopenDevContainer(...args:string[]):Promise<void>{
623+
publicasyncopenDevContainer(
624+
workspaceOwner:string,
625+
workspaceName:string,
626+
workspaceAgent:string,
627+
devContainerName:string,
628+
devContainerFolder:string,
629+
localWorkspaceFolder:string="",
630+
localConfigFile:string="",
631+
):Promise<void>{
624632
constbaseUrl=this.restClient.getAxiosInstance().defaults.baseURL;
625633
if(!baseUrl){
626634
thrownewError("You are not logged in");
627635
}
628636

629-
constworkspaceOwner=args[0]asstring;
630-
constworkspaceName=args[1]asstring;
631-
constworkspaceAgent=args[2]asstring;
632-
constdevContainerName=args[3]asstring;
633-
constdevContainerFolder=args[4]asstring;
634-
635637
awaitopenDevContainer(
636638
baseUrl,
637639
workspaceOwner,
638640
workspaceName,
639641
workspaceAgent,
640642
devContainerName,
641643
devContainerFolder,
644+
localWorkspaceFolder,
645+
localConfigFile,
642646
);
643647
}
644648

@@ -751,6 +755,8 @@ async function openDevContainer(
751755
workspaceAgent:string,
752756
devContainerName:string,
753757
devContainerFolder:string,
758+
localWorkspaceFolder:string="",
759+
localConfigFile:string="",
754760
){
755761
constremoteAuthority=toRemoteAuthority(
756762
baseUrl,
@@ -759,11 +765,26 @@ async function openDevContainer(
759765
workspaceAgent,
760766
);
761767

768+
consthostPath=localWorkspaceFolder ?localWorkspaceFolder :undefined;
769+
constconfigFile=
770+
hostPath&&localConfigFile
771+
?{
772+
path:localConfigFile,
773+
scheme:"vscode-fileHost",
774+
}
775+
:undefined;
762776
constdevContainer=Buffer.from(
763-
JSON.stringify({containerName:devContainerName}),
777+
JSON.stringify({
778+
containerName:devContainerName,
779+
hostPath,
780+
configFile,
781+
localDocker:false,
782+
}),
764783
"utf-8",
765784
).toString("hex");
766-
constdevContainerAuthority=`attached-container+${devContainer}@${remoteAuthority}`;
785+
786+
consttype=localWorkspaceFolder ?"dev-container" :"attached-container";
787+
constdevContainerAuthority=`${type}+${devContainer}@${remoteAuthority}`;
767788

768789
letnewWindow=true;
769790
if(!vscode.workspace.workspaceFolders?.length){

‎src/extension.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
165165
constworkspaceAgent=params.get("agent");
166166
constdevContainerName=params.get("devContainerName");
167167
constdevContainerFolder=params.get("devContainerFolder");
168+
constlocalWorkspaceFolder=params.get("localWorkspaceFolder");
169+
constlocalConfigFile=params.get("localConfigFile");
168170

169171
if(!workspaceOwner){
170172
thrownewError(
@@ -190,6 +192,12 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
190192
);
191193
}
192194

195+
if(localConfigFile&&!localWorkspaceFolder){
196+
thrownewError(
197+
"local workspace folder must be specified as a query parameter if local config file is provided",
198+
);
199+
}
200+
193201
// We are not guaranteed that the URL we currently have is for the URL
194202
// this workspace belongs to, or that we even have a URL at all (the
195203
// queries will default to localhost) so ask for it if missing.
@@ -228,6 +236,8 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
228236
workspaceAgent,
229237
devContainerName,
230238
devContainerFolder,
239+
localWorkspaceFolder,
240+
localConfigFile,
231241
);
232242
}else{
233243
thrownewError(`Unknown path${uri.path}`);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp