VSCode Extension Dev: How do I know if vscode is connected to a remote or devcontainer? - visual-studio-code

Is there a reliable way my extension can identify if the current vscode window is connected to a remote or devcontainer? My extension helps configure our dev environments and I need to behave differently in those cases. Thanks.
I've tried to find a vscode api that will tell me the remote status but cant find anything.

Related

Build vscode server from vscode source code

I've been using gitpod's OpenVSCode Server recently, which is mostly based on VSCode. I looked at some of VSCode's documentation on Github, but I don't know how this is implemented. It seems that VSCode's official vscode server is not public. May I know how to package VSCode source code as vscode server?
I've tried many ways, but it doesn't work

What's the vscode:// syntaxis to create an automatic redirect to a SSH connection into VSCode?

I've used GitHub Codespaces and I wanted to develop something similar using the Remote-SSH extension and I'd like to have a web interface where a button automatically redirects to Visual Studio Code opening the connection and setting up the environment instead of having to manually write the IP address and password for SSH connection, I read the Codespaces code to figure out how they were doing it and found this code.
vscode://github.codespaces/connect?name=<CONTAINER-NAME>&windowId=_blank
Note: I changed my container's name for <CONTAINER-NAME>
They're using the URL Scheme (vscode://) to call the extension github.codespaces and pass a container-name to the variable name in the command connect.
I'd like to use the same but with the Remote-SSH extension and the addNewSshHost to add a new host to my ssh list.
and openEmptyWindow to bind the connection with the added host.
I think that these commands have certain parameters but I don't know where to find them, I've already searched for documentation and there's none.
Hope anybody can help me with the vscode:// syntax for general extensions, thanks
I've tried writing vscode://ms-vscode-remote.remote-ssh/connect?host=<USER>#<IP>&windowId=_blank but It doesn't work, just opens a new VS Code's Window but doesn't add a host or anything, I'd like to have a command to add to a button such as Codespaces does to open the IDE automatically.

Debugging new VS Code CLI flag in devcontainer

I've forked VSCode on Github to try to add a tiny little feature I think would be useful, which adds a new CLI flag to code, to be used inside the VSCode terminal (like code - for stdin). I added the code, wrote tests, and now I want to try out the feature.
I'm developing inside the built-in devcontainer, so I just launched an instance of VSCode from within VSCode, connected to the devcontainer via VNC and tried to use my flag inside the VSCode-OSS terminal. However, I get an error saying "Command is only available in WSL or inside a Visual Studio Code terminal"
According to server.cli.ts, this means that the env variables VSCODE_IPC_HOOK_CLI and VSCODE_CLIENT_COMMAND aren't set, but I don't know who should be setting them, or if I need to launch VSCode in a different way for debugging.
Has anyone using the VSCode DevContainer to write additional CLI flags and knows how to debug them?

How do I use ZModem in Visual Studio Code?

Is it possible to configure vs code to support the ZMODEM protocol? I could use xshell to download files with sz command, but when I try to use sz in vs code, here it returns some random number.
(base) [alpha#hpc03 newfile]$ sz INCAR
�*B00000000000000
I use Remote-SSH extension in vs code to connect to the Linux system.
My question is:
Is there any extension or configuration method that would allow me to use sz in vs code?
As far as I know (I looked, didn't find anything) there's no existing extension or method to use the ZModem protocol with VSCode. However, there's a pull request from 2017 that adds support for it to Xterm, which is the terminal display VSCode uses. As indicated in this mentioning issue the VSCode developers would need more information.
As far as an extension goes, if you or anyone reading this wanted to make an extension for this purpose, you could use this ZModem.js implementation of the protocol in Javascript, and write the extension yourself, or do something similar.
From the Remote-SSH docs
VS Code will look for the ssh command in the PATH. Failing that, on Windows it will attempt to find ssh.exe in the default Git for Windows install path. You can also specifically tell VS Code where to find the SSH client by adding the remote.SSH.path property to settings.json.
Maybe you can include Xshell somehow this way. Or find a windows version of zssh (not this from the Ziti project) and it could work. Another candidate is SecureCRT. (via). Probably these rich GUI apps are not embeddable as simple CLI programs, though. Which would be a useful feature in this case.

Is there a way to sync the settings between local and remote for vscode?

So the latest version of vscode (1.46) provides preference sync, but I found I cannot enable this feature for remote vscode. Whenever I open remote folder, (e.g., in wsl), the option to sign in MS account and turn on preference sync is missing. Did I miss anything here or it is not supported?
figure below shows my local vscode instance with the preference sync:
figure below shows my vscode instance for remote (wsl) without the preference sync option:
https://code.visualstudio.com/docs/editor/settings-sync
I was looking to enable this too, the first line is the answer I think. Only available for vscode insiders at the moment, maybe wait 'til next month