Published at
Updated at
Reading time
1min

Today I read a post about Matthias Ott's VS Code setup. I love these posts because you can always discover new things.

After reading it, I shared on Twitter that you can handle and automate your VSCode extension setup with shell commands.

code --install-extension extensionAuthor.extensionName
code --install-extension anotherExtensionAuthor.anotherExtensionName

I've been maintaining a script in my dotfiles to manage my extensions. Meaning, whenever I added a new extension, I had to update this script manually. @shdli shared a way nicer way of handling these repetitive commands. He called it a "manifest'y approach".

# backing up VS Code extensions
code --list-extensions > "./visual-studio-code-extensions.txt"

# installing VS Code extensions
cat  "./visual-studio-code-extensions.txt" | xargs -L 1 code --install-extension

Export all your installed extensions using code --list-extensions, write them to disk, and install them using some shell piping magic and xargs. That's a very sweet way of automating VS Code extensions!

This new manifest approach immediately led to me introducing commands like install and backup in my dotfiles. 🙈 My dotfiles are not well documented, reach out via Twitter or write me an email if you have questions.

If you enjoyed this article...

Join 5.5k readers and learn something new every week with Web Weekly.

Web Weekly — Your friendly Web Dev newsletter
Reply to this post and share your thoughts via good old email.
Stefan standing in the park in front of a green background

About Stefan Judis

Frontend nerd with over ten years of experience, freelance dev, "Today I Learned" blogger, conference speaker, and Open Source maintainer.

Related Topics

Related Articles