Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install multiple extensions in VSCode using command line

How can I install multiple extensions in VSCode using the cli? I tried:

code --install-extension xyz.local-history jock.svg

but it only installs the first extension xyz.local-history.

Installing extensions...
Installing extension 'xyz.local-history' v1.7.0...
(node:10874) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
Extension 'xyz.local-history' v1.7.0 was successfully installed.
like image 638
BuZZ-dEE Avatar asked Dec 22 '22 20:12

BuZZ-dEE


1 Answers

If you are use Unix/Linux create a bash script with a loop. In this case I want to backup the extensions list and install again:

First create a list of the extensions:

$ code --list-extensions > extensions.txt

Create a bash script for example with the name vscode-extension-install.sh and input the following code:

#!/usr/bin/env bash

cat extensions.txt | while read extension || [[ -n $extension ]];
do
  code --install-extension $extension --force
done

Then run:

$ ./vscode-extension-install.sh

Example output:

Installing extensions...
Installing extension 'visualstudioexptteam.vscodeintellicode' v1.2.6...
Extension 'visualstudioexptteam.vscodeintellicode' v1.2.6 was successfully installed.
Installing extensions...
Installing extension 'vscode-icons-team.vscode-icons' v10.0.0...
Extension 'vscode-icons-team.vscode-icons' v10.0.0 was successfully installed.
...

From my gists

like image 117
illvart Avatar answered Dec 27 '22 06:12

illvart