Vscode-remote-release: open remote directory/file from client machine's command line

Created on 6 Jun 2019  Â·  7Comments  Â·  Source: microsoft/vscode-remote-release


Same as open a local file "code-insiders bar" can we do the same, from client machine's terminal: "code-insiders ssh://foo.com/home/username/bar"?

It makes us easily open a code directly connect to the remote server. It's different than https://github.com/microsoft/vscode-remote-release/issues/263 where you need to connect to the remote server first.

feature-request on-testplan plan-item

Most helpful comment

It's already possible to directly open remote files & folders using --file-uriand --folder-uri

  • code --file-uri vscode-remote://ssh-remote+myubuntubox/home/x/projects/test.code-workspace
  • code --folder-uri vscode-remote://ssh-remote+myubuntubox/home/x/projects/foo

I added a simpler notation:

  • code --remote ssh-remote+myubuntubox /home/x/projects/foo

There's still more work needed to give good user feedback if the remote or the path can not resolve

All 7 comments

@roblourens , can we rename this issue to reflect this is general requirement not limited to remote and/or SSH based access?

As designed VSCode launches a project containing a .devcontainer it starts in local mode prompting to reopen in a container.

"Folder contains a dev container configuration file. Reopen folder to develop in a container (learn more)."

I would like to have an option added to the command line to allow the dev container to be opened by default for example:

code-insider /uri-path-to-project-folder --dev-container or  
code-insider /uri-path-to-project-folder --mode=dev-container

when this extension is enabled.

The current steps to connect to a remote directory are:

  1. Remote-SSH: Connect to Host…
  2. Select host
  3. Wait
  4. Open Folder
  5. Select folder
  6. Wait

This is compared to just running code path from WSL. Connecting to SSH is relatively very cumbersome and should instead just take an SSH path to replace almost all of these steps.

It's already possible to directly open remote files & folders using --file-uriand --folder-uri

  • code --file-uri vscode-remote://ssh-remote+myubuntubox/home/x/projects/test.code-workspace
  • code --folder-uri vscode-remote://ssh-remote+myubuntubox/home/x/projects/foo

I added a simpler notation:

  • code --remote ssh-remote+myubuntubox /home/x/projects/foo

There's still more work needed to give good user feedback if the remote or the path can not resolve

Thank you @aeschli . I tried
code --file-uri vscode-remote://ssh-remote+myubuntubox/home/x/projects/test.code-workspace and code --folder-uri vscode-remote://ssh-remote+myubuntubox/home/x/projects/foo. Both are working. The code --remote ssh-remote+myubuntubox /home/x/projects/foo, however, didn't work. My Remote Development version is 0.178.0 and "Remote -SSH" version is 0.46.1

@yingbo I will be in tomorrows insider build...

Got it, thanks! I like the idea of code --remote ssh-remote+myubuntubox /home/x/projects/foo.

@aeschli How can you do this with (Docker) Remote Containers? I was thinking a simple code --remote . would be nice

Was this page helpful?
0 / 5 - 0 ratings