Search code examples
linuxvisual-studio-codevscode-remote

How do you install an extension into the VS Code Server that's the remote end of Remote-SSH when there is no Internet connection?


I'm working in a network that has no direct internet connection.

I have VS Code on my desktop PC and I use the "Remote - SSH" extension (version 0.55) to do development on a Linux VM. It works very well.

From time to time I have need to install other Extensions into both the desktop VS Code (which is an easily accomplished using code --install-extension <path-to-vsix>) and also the Linux end of the "Remote - SSH" server.

My question is "under these circumstances, how do I correctly install Extensions into the Linux server?"

I will describe what I do, which partially works sometimes, but I have used this process to upgrade extensions and lost features (like coloring of output) so there must be something missing. I would like to know the missing step.

  1. Download the extension from an internet-connected computer. There is a "Download Extension" link on the Extension's page at marketplace.visualstudio.com/vscode. Copy it (however you can) onto your Linux development host.
  2. Copy the VSIX file to ~/.vscode-server/data/CachedExtensionVSIXs/ and rename the file by getting rid of the ".vsix" extension.
  3. Sometimes the extension becomes installable at this stage. I'm not sure what the differences are between cases when this has worked and when it sometimes doesn't work. At least it's worth trying --- go to VS Code, connect to your remote host, look in the Extensions panel and if you can install it from there, good for you. If it didn't work, close the connection to the Remote Host.
  4. Assuming that the previous step failed, you will need to unzip the VSIX and copy it into place. The following code uses the cmake-tools extension as an example.
cd /tmp
mkdir cmaketools && cd cmaketools
7z x -tzip ~/.vscode-server/data/CachedExtensionVSIXs/ms-vscode.cmake-tools-1.4.2
cd ~/.vscode-server/extensions/
mv /tmp/cmaketools/extension ms-vscode.cmake-tools-1.4.2
cd ms-vscode.cmake-tools-1.4.2/
cp /tmp/cmaketools/extension.vsixmanifest .vsixmanifest

Solution

  • You can download the extension from the Marketplace and upload the extensionvsix file to the remote.

    In the remote VSC use the Install from VSIX... command on the Extension bar top menu.