Presently the Remote OSS extension supports a "manual" host type, where the user sets up a tunnel to the remote extension host themselves. I want to add a "script" type, where the user can specify some shell scripts that do this for them. Here's my proposal:
The configuration for a "script" host is similar to a "manual" one with the following differences:
listenScript is added, which is a shell script that sets up a listener.
localDirectory is added, which specifies the local directory to run scripts in.
additionalScripts is added, which is a set of {name, script} objects that allow the user to perform additional behaviors ("restart remote machine", "recreate dev container" or whatever else is useful for the user). These scripts run locally just like the listenScript, and exposed as custom commands in the command palette.
- And finally
connectScript is added, which is exclusive with host/port/listenScript. This script is executed locally and is expected to establish a connection to an HTTP server over stdio. When specified, the remote extension host communicates using this script instead of a network connection.
This last one seems a bit weird, but it's because when working with devcontainers, we can't actually add port forwards without recreating the container. The only way to get a channel into a devcontainer that's already running is over stdio and docker exec. This is how the Microsoft Remote - Dev Containers extension works and it works fine with Remote OSS as well (although it presently requires using netcat/socat to forward network connections over a docker exec channel).
So, with these changes, a user will be able to specify the scripts needed to connect to a remote, and can have vscode run the scripts for them. Disconnections are going to be a bit tricky: I'm thinking that the listenScript/connectScript are expected to exit to indicate a disconnection event, and the extension will rerun them. This is tricky to do for the listenScript, so the extension will probably also just kill it when it detects a disconnection event itself.
Would a pull request implementing these features be accepted? If not, I can just make a new extension. Let me know. Thank you!
For those curious how to get Remote OSS working with dev containers today, I'm using a custom vscodium-server script on my laptop that I combine with SSH and the official devcontainer CLI to open a remote devcontainer. Remote OSS is supported today by using something like vscodium-server listen "devcontainer exec -- sh -c"
Presently the Remote OSS extension supports a "manual" host type, where the user sets up a tunnel to the remote extension host themselves. I want to add a "script" type, where the user can specify some shell scripts that do this for them. Here's my proposal:
The configuration for a "script" host is similar to a "manual" one with the following differences:
listenScriptis added, which is a shell script that sets up a listener.localDirectoryis added, which specifies the local directory to run scripts in.additionalScriptsis added, which is a set of{name, script}objects that allow the user to perform additional behaviors ("restart remote machine", "recreate dev container" or whatever else is useful for the user). These scripts run locally just like thelistenScript, and exposed as custom commands in the command palette.connectScriptis added, which is exclusive withhost/port/listenScript. This script is executed locally and is expected to establish a connection to an HTTP server over stdio. When specified, the remote extension host communicates using this script instead of a network connection.This last one seems a bit weird, but it's because when working with devcontainers, we can't actually add port forwards without recreating the container. The only way to get a channel into a devcontainer that's already running is over stdio and
docker exec. This is how the Microsoft Remote - Dev Containers extension works and it works fine with Remote OSS as well (although it presently requires using netcat/socat to forward network connections over a docker exec channel).So, with these changes, a user will be able to specify the scripts needed to connect to a remote, and can have vscode run the scripts for them. Disconnections are going to be a bit tricky: I'm thinking that the
listenScript/connectScriptare expected to exit to indicate a disconnection event, and the extension will rerun them. This is tricky to do for thelistenScript, so the extension will probably also just kill it when it detects a disconnection event itself.Would a pull request implementing these features be accepted? If not, I can just make a new extension. Let me know. Thank you!
For those curious how to get Remote OSS working with dev containers today, I'm using a custom vscodium-server script on my laptop that I combine with SSH and the official devcontainer CLI to open a remote devcontainer. Remote OSS is supported today by using something like
vscodium-server listen "devcontainer exec -- sh -c"