Visual Studio Code supports remote development over SSH. If you're using this feature to develop X-Window GUI apps in remote machines, you can follow the steps described below and enable SSH X11 forwarding for launching your GUI apps directly from the integrated terminal in Visual Studio Code.
Please note that the steps shown below is *not* for WSL (Windows Subsystem for Linux). Visual Studio Code has a separate extension for WSL, and you don't need SSH X11 forwarding for interacting with X-Window GUI apps; you just need to have a working DISPLAY environment variable set up for WSL.
Any Windows SSH client can be used with X410 as long as the client supports X11 forwarding. For the built-in SSH client in Windows, you just need to make sure Loopback' option is always enabled (you cannot disable it even if you want to), you don't need any additional set up for X410.
» option in X410 is enabled. But, since that '
Just make sure X410 is running!
Windows 10 version 1809 or later has a built-in SSH client. Visual Studio Code makes use of this built-in SSH client for remote development over SSH. Although you can install and use a different SSH client with Visual Studio Code, we'll be focusing on using the built-in one as it's readily available and should support X11 forwarding in its recent versions.
We prepared the following post about enabling X11 forwarding for the built-in Windows SSH client. Please follow those steps described in the post and make sure you can use X11 forwarding with your built-in SSH client.
Built-in SSH X11 forwarding in PowerShell or Windows Command Prompt
Please note that you must permanently add the DISPLAY environment variable for Windows as described in the Step 3 of the above post. The built-in SSH client requires that DISPLAY environment variable for connecting back to X410 when it's internally executed by Visual Studio Code.
setx DISPLAY "127.0.0.1:0.0"
When you're connecting to a new remote machine in SSH, append
-X -Y or
You don't need to specify the
-X switch while using the built-in SSH client in PowerShell or Windows Command Prompt, but it must be added while using it in Visual Studio Code. It seems Visual Studio Code first creates an entry for the new address and converts the command-line switches to SSH options. When the built-in SSH client is directly launched only with
-Y (ForwardX11Trusted) switch,
-X (ForwardX11) is automatically implied and enabled, but the converter in Visual Studio Code doesn't seem to be doing that. Hence you must explicitly add the
If you already have an entry set up for your remote machine in Visual Studio Code, you can add the following lines to the entry and enable X11 forwarding.
X11 forwarding should now be ready for your remote development. Try opening an integrated terminal in Visual Studio Code for your remote machine and check its
DISPLAY environment variable; if X11 forwarding is enabled and active, you should see it's automatically configured for
localhost:10.0 or similar instead of an empty value.