5

How do I install VSCode extensions in an SSH connection without doing it through the VSCode UI? I have an environment that spins up a new VM for git branches, and it's really annoying to have to go manually install every extension for each new VM.

I've tried adding them to a devcontainer.json file, which is ignored (it only works on containers, not ssh, even in the newest release that's had some support for the file via ssh connections).

I could add a bunch of packages to vscode's settings, but I want to avoid that because what I install is different based on whether I'm looking at a rust service, node, etc and it's pretty pointless to install every conceivable package in every vm.

1 Answers1

5

#get extendsions ids

  1. cmd:
    code --list-extensions
    //foo.bar
    //foo1.bar2
    
  2. Visual Studio Code: Open settings file, add option:
    "remote.SSH.defaultExtensions": [
        "foo.bar",
     ]
    
  3. ssh remote ssh rm ~/.vscode-server
    
  4. vscode reconnect remote server
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
walkman
  • 1,743
  • 2
  • 10
  • 10
  • 1
    The source for this hack plus more info can be found on VSCode's website [here](https://code.visualstudio.com/docs/remote/ssh#_always-installed-extensions). – E. Turok Sep 28 '22 at 16:25