Hardening VS Code Extensions

joaopalmeiro1 pts0 comments

Hardening VS Code extensions | Patches<br>VS Code extensions are updated automatically by default. Although I am careful when installing a new extension, I used to manage them less strictly than project<br>dependencies. Here are the steps for my current workflow:

Disable automatic extension updates

Add the following settings to the VS Code user (global) settings:

"extensions.autoCheckUpdates": false,<br>"extensions.autoUpdate": false<br>Save a pseudo-lockfile of installed extensions

First, review the installed extensions and uninstall the unused ones. Then run the following command:

code --list-extensions --show-versions > vscode_extensions.txt<br>Keep the generated file somewhere, like in a dotfiles repo. This file makes it easier to get VS Code up and running after a fresh install (and if you don't use Settings Sync). To do so, run the following command:

xargs --max-lines=1 code --install-extension vscode_extensions.txt<br>Update extensions manually

Run the Extensions: Check for Extension Updates command from the VS Code Command Palette to flag the<br>extensions with available updates. Go through the list, check the repos and other resources for any reported issues,<br>and update them if everything looks good.

If the latest version of one of the outdated extensions is less than 7 days old (or whatever cooldown period you follow), open the dropdown menu next to Uninstall and choose Install Specific Version...,<br>or skip it this time.

Finally, update the pseudo-lockfile and repeat from time to time.

extensions code extension command updates following

Related Articles