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

fix: improveopenDevContainer support with local workspace folder#544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletionsCHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,9 @@

## Unreleased

- Update `/openDevContainer` to support all dev container features when hostPath
and configFile are provided.

## [v1.9.2](https://github.com/coder/vscode-coder/releases/tag/v1.9.2) 2025-06-25

### Fixed
Expand Down
39 changes: 30 additions & 9 deletionssrc/commands.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -620,25 +620,29 @@ export class Commands {
*
* Throw if not logged into a deployment.
*/
public async openDevContainer(...args: string[]): Promise<void> {
public async openDevContainer(
workspaceOwner: string,
workspaceName: string,
workspaceAgent: string,
devContainerName: string,
devContainerFolder: string,
localWorkspaceFolder: string = "",
localConfigFile: string = "",
): Promise<void> {
const baseUrl = this.restClient.getAxiosInstance().defaults.baseURL;
if (!baseUrl) {
throw new Error("You are not logged in");
}

const workspaceOwner = args[0] as string;
const workspaceName = args[1] as string;
const workspaceAgent = args[2] as string;
const devContainerName = args[3] as string;
const devContainerFolder = args[4] as string;

await openDevContainer(
baseUrl,
workspaceOwner,
workspaceName,
workspaceAgent,
devContainerName,
devContainerFolder,
localWorkspaceFolder,
localConfigFile,
);
}

Expand DownExpand Up@@ -751,6 +755,8 @@ async function openDevContainer(
workspaceAgent: string,
devContainerName: string,
devContainerFolder: string,
localWorkspaceFolder: string = "",
localConfigFile: string = "",
) {
const remoteAuthority = toRemoteAuthority(
baseUrl,
Expand All@@ -759,11 +765,26 @@ async function openDevContainer(
workspaceAgent,
);

const hostPath = localWorkspaceFolder ? localWorkspaceFolder : undefined;
const configFile =
hostPath && localConfigFile
? {
path: localConfigFile,
scheme: "vscode-fileHost",
}
: undefined;
const devContainer = Buffer.from(
JSON.stringify({ containerName: devContainerName }),
JSON.stringify({
containerName: devContainerName,
hostPath,
configFile,
localDocker: false,
}),
"utf-8",
).toString("hex");
const devContainerAuthority = `attached-container+${devContainer}@${remoteAuthority}`;

const type = localWorkspaceFolder ? "dev-container" : "attached-container";
const devContainerAuthority = `${type}+${devContainer}@${remoteAuthority}`;

let newWindow = true;
if (!vscode.workspace.workspaceFolders?.length) {
Expand Down
10 changes: 10 additions & 0 deletionssrc/extension.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -165,6 +165,8 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
const workspaceAgent = params.get("agent");
const devContainerName = params.get("devContainerName");
const devContainerFolder = params.get("devContainerFolder");
const localWorkspaceFolder = params.get("localWorkspaceFolder");
const localConfigFile = params.get("localConfigFile");

if (!workspaceOwner) {
throw new Error(
Expand All@@ -190,6 +192,12 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
);
}

if (localConfigFile && !localWorkspaceFolder) {
throw new Error(
"local workspace folder must be specified as a query parameter if local config file is provided",
);
}

// We are not guaranteed that the URL we currently have is for the URL
// this workspace belongs to, or that we even have a URL at all (the
// queries will default to localhost) so ask for it if missing.
Expand DownExpand Up@@ -228,6 +236,8 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
workspaceAgent,
devContainerName,
devContainerFolder,
localWorkspaceFolder,
localConfigFile,
);
} else {
throw new Error(`Unknown path ${uri.path}`);
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp