question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support running remotely for VS Code Remote Development

See original GitHub issue

Hi, I’m on the VS Code team. We recently released support for Remote Development and I believe that your extension may not work properly when run in a remote workspace

Problem

To make remote development as transparent as possible to users, VS Code distinguishes two classes of extensions:

  • UI Extensions: These extensions make contributions to the VS Code user interface and are always run on the user’s local machine. UI Extensions cannot directly access files in the workspace, or run scripts/tools installed in that workspace or on the machine. Example UI Extensions include: themes, snippets, language grammars, and keymaps.

  • Workspace Extensions: These extensions are run on the same machine as where the workspace is located. When in a local workspace, Workspace Extensions are run on the local machine. When in a remote workspace, Workspace Extensions are run on the remote machine. Workspace Extensions can access files in the workspace to provide rich, multi-file language services, debugger support, or perform complex operations on multiple files in workspace (either themselves or by invoking scripts/tools).

You can find more details about this architecture here.

Your extension is currently running as workspace extension. This means that the server it starts will be run on the remote machine, which in turn means that webview will not be able to access it using localhost since the webview is running on the user’s local machine:

Potential Fix

We’ve introduced a new webview port mapping API that should make it possible for your extension to run remotely with fairly minor modifications.

Please let me know if you have any questions about the issue or the new apis. We’ve also put together a guide to help you test your extension in remote workspaces

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:23
  • Comments:9

github_iconTop GitHub Comments

2reactions
ole1986commented, Nov 7, 2019

This will be fixed in PR #401 without configuring Remote-SSH to forward ports

1reaction
tpfei578commented, Aug 18, 2019

Thans

OK, I figured it out - you need to open up the Output panel and look at the output for Git History for the following line and take the port number from there (9999 in this case):

Server running on http://localhost:9999/?_&id=xxxxxyyyyyzzzz&branchName=master&file=&theme=&branchSelection=1&locale=en_US

Since the port number changes every time, you need to forward the port each time you open the remote folder.

Thanks According to your answer, I found a way to temporarily forward a new port for the duration of the SSH session. "

run the Remote-SSH: Forward Port from Active Host… command when connected to an active SSH host."

https://code.visualstudio.com/docs/remote/ssh

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remote Development using SSH - Visual Studio Code
The Visual Studio Code Remote - SSH extension allows you to open a remote folder on any remote machine, virtual machine, or container...
Read more >
Visual Studio Code Remote Development
The VS Code Server is a private preview service you can run on a remote development machine, like your desktop PC or a...
Read more >
Remote Development FAQ - Visual Studio Code
Visual Studio Code Remote Development allows your local VS Code installation to transparently interact with source code and runtime environments on other ...
Read more >
Visual Studio Code Server
The Visual Studio Code Server is a service you can run on a remote development machine, like your desktop PC or a virtual...
Read more >
Remote Development Tips and Tricks - Visual Studio Code
This article covers troubleshooting tips and tricks for each of the Visual Studio Code Remote Development extensions. See the SSH, Containers, and WSL...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found