I messed up and deleted an extension I shouldn’t have uninstalled but like uninstalled extensions are all still in the folder and I don’t wanna manually install back everything I uninstalled so is there a way to just install everything
I tried many commands to get the extensions and install them but that only got already installed extensions code –list-extensions –show-versions > extensions4.txt
and then i tried just getting all the folder names but the format needs to be {name}@{version} for installing but the folders arent named accordingly so like idk what to do they are so many and i dont know how to (on windows)
2
Answers
Windows(CMD) Kinda buggy and some extensions fail to install
go to the extensions folder for vs code
open it
open command prompt and cd into the extensions folder
run this command
you will get a file with all the sub folders in the folder but the names will have this format {name}-{version} and we need {name}@{version} to install things properly so we need to use this python script
copy the output in the terminal which will be {name}@{version} and save it to the same extensions.txt file in the folder
then go back to cmd and run this command
all extensions will start to be installed
IMPORTANT DETAIL when you run the first command the file may have 1 or 2 files that are in the extensions folder like the extensions.json so delete those from the extensions.txt file
You could do the following using
jq
. To install the extensions named by directories in your${HOME}/.vscode/extenions
folder, try the following:find "${HOME}/.vscode/extensions" -maxdepth 2 -name 'package.json' | xargs -I % jq -r '.publisher+"."+.name' -- % | xargs -I % code '--install-extension %'
It’s a bit janky of an approach and relies on the UNIX
find
command (sorry). If you’re on Windows and you’re doing dev work, your probably already have Git Bash though, so you can run it from there.