Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Support "Open in VSCode" for devcontainers #16426

Closed
johnstcn opened this issue Feb 4, 2025 · 3 comments · Fixed by #17182
Closed

UI: Support "Open in VSCode" for devcontainers #16426

johnstcn opened this issue Feb 4, 2025 · 3 comments · Fixed by #17182
Assignees
Labels
site Area: frontend dashboard

Comments

@johnstcn
Copy link
Member

johnstcn commented Feb 4, 2025

Update the Open in VSCode button URL to construct a vscode-remote://dev-container URL to allow users to jump directly to the devcontainer inside VSCode.

This is an undocumented feature, but some enterprising folks have figured out how to do this: https://github.com/felipecrs/dotfiles/blob/master/home/dot_local/bin/executable_code#L113

More information on this URL format is available here: https://blog.lohr.dev/launching-dev-containers

@johnstcn johnstcn added the site Area: frontend dashboard label Feb 4, 2025
@DanielleMaywood
Copy link
Contributor

Just wanted to note down my findings so I don't lose them:

vscode://vscode-remote/dev-container+$DEVCONTAINER@ssh-remote+$HOST/workspaces/terraform-provider-coder

Where $DEVCONTAINER is defined as the base64 encoding of

{
    "hostPath": "/home/coder/terraform-provider-coder",
    "configFile":{
        "path": "/home/coder/terraform-provider-coder/.devcontainer/devcontainer.json",
        "scheme": "vscode-remote", 
        "authority": "ssh-remote+$HOST"
    }
}

And $HOST is the remote.

@DanielleMaywood
Copy link
Contributor

DanielleMaywood commented Mar 28, 2025

I have upgraded the complexity from II to III as this also requires a change to the vscode extension, meaning it's a larger change than originally expected.

@DanielleMaywood
Copy link
Contributor

DanielleMaywood commented Mar 30, 2025

Looks like my previous findings goes down the wrong path. When using the URI vscode://vscode-remote/dev-container+ it starts a dev container with the given parameters, instead of connecting to an existing dev container.

What we instead want is a URI in the form

vscode://vscode-remote/attached-container+$DEVCONTAINER@ssh-remote+$HOST

Where $DEVCONTAINER is defined as the base64 encoding of

{
    "containerName": "some_container_name"
}

And $HOST is the remote.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site Area: frontend dashboard
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants