Native VS Code SSH extension to FreeBSD Host

"Farhan Khan" <[email protected]>
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <[email protected]>
Hi all,

I spent a bit of time trying to figure out how to get VS Code's ssh extension to run on a native FreeBSD host. I did not finish but amwanted to share some notes and a path forward. Unfortunately this would ultimately require a contact at Microsoft to fully proceed, but the two steps are:
A) Make this Rust package build on FreeBSD: https://github.com/microsoft/vscode/tree/main/cli
B) Contact Microsoft to update their proprietary SSH extension.js file for FreeBSD.

Famous last words, but this does not seem that difficult to do. 

---

Detailed notes:

The extension code is not open source, its obfuscated JS code located in this path on my Linux host:
$HOME/.vscode/extensions/ms-vscode-remote.remote-ssh-0.122.0/out/extensions.js

I ran it through a JS beautifier and could see snippets of what I knew what was happening. Here's are the relevant parts from what I gathered. After SSH'ing to your machine, the extension does the following:

Step 1: Sanity Check to make sure this system has the basics it needs:
```
echo ready: RANDOM-STRING
uname -rsv
echo $SHELL
sh
```

I'm not clear, but from looking at the code it appears to allow Linux, Windows, Darwin and maybe cygwin and Windows_NT.

Step 2: This sequence seems to be to determine the OS and architecture for the sake of uploading the correct version of the Code agent that runs on the remote host.
```
uname -s
uname -m
uname -r
getconf LONG_BIT
```

Step 3: Download the code CLI.

Based on the above, it will curl and/or scp over an xz file containing the right version of the  `code` executable, unzip it and run. The executable `code` is this Rust binary.: https://github.com/microsoft/vscode/tree/main/cli

Step 4: I didn't get that far...not sure what's next :/

I do not know Rust, but just to test things out I used Gemini's AI to get it to build. Unfortunately I seemed to have lost the code and it was probably broken anyways, but I suspect its possible and/or trivial to get working.

Assuming there is nothing very OS-specific going on -- and what could that even be if it works on three divergent OSes -- this seems like a few quick patches someone could do before pushing to the github repo for review. The extension, being proprietary, will require a contact to actually update.

Thoughts?

--
Farhan Khan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.