user578895
user578895

Reputation:

VSCode remote ssh -- how to automatically install extensions

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.

Upvotes: 7

Views: 6788

Answers (1)

walkman
walkman

Reputation: 1861

#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

Upvotes: 10

Related Questions