10

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
Gama11
  • 31,714
  • 9
  • 78
  • 100
Peter Du
  • 548
  • 1
  • 10
  • 20
  • download and upload the `vsix` file for the extension and use the `Install from vsix` command on the extension bar top menu – rioV8 Sep 23 '20 at 10:47
  • @rioV8 If you want, make this an answer and I will accept. You solved my problem. – Peter Du Sep 23 '20 at 13:16

2 Answers2

11

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.

rioV8
  • 24,506
  • 3
  • 32
  • 49
  • 1
    is there a way to do this from the command line ? – filaton Jun 01 '22 at 10:28
  • @filaton What does the doc page on command line say about this – rioV8 Jun 01 '22 at 11:24
  • not much, it doesn't mention anything about SSH (https://code.visualstudio.com/docs/editor/command-line#_working-with-extensions) – filaton Jun 02 '22 at 13:10
  • @filaton Where do you expect the remote VSC to get the extension, you don't have internet, why should it mention SSH – rioV8 Jun 02 '22 at 13:24
  • sorry, in my use case, the remote has access to the internet. Basically I'm just looking for a way to reproduce the behavior of the "Install in SSH: " button that you have when you search for extensions in an SSH remote. – filaton Jun 03 '22 at 14:54
1

If you want to install it from the command line on the remote:

  • get the name of the current server directory (easiest: connect to the remote workspace, then run ps -u $USER -o pid,ppid,user,pcpu,pmem,etime,args via the vscode terminal)
    This can get you, for example to
    /home/me/.codium-server/bin/8311b9c0ddd6ed7738146332e5a0629c76f17be3/bin/
  • execute the server runtime (in this case codium-server, often vscode-server) from this directory with the --install-extension <path-to-vsix> command
Simon Sobisch
  • 6,263
  • 1
  • 18
  • 38