Automating VS Code Extension Installation

Automating VS Code Extension Installation

It can be frustrating to install all the extensions you are used to one at a time when you install a fresh version of your OS or move from one machine to another. So, I decided to create a simple bash script that will install all my required extensions.

FTR, I am mostly using C# and JS so my extension choices are mostly geared towards those but the script can be used to replace it with any list of extensions. The ids of extensions are visible from the extension page itself under More Info section.

Screen Shot 2021-08-27 at 11.59.32 PM.png

#!/bin/bash

# Color
GREEN='\033[0;32m'
YELLOW='\033[0;33m'

function green {
    printf "${GREEN}$@${NC}\n"
}

function yellow {
    printf "${YELLOW}$@${NC}\n"
}

# List of extensions
declare -a extensions=(
    "aaron-bond.better-comments"
    "ms-dotnettools.csharp"
    "ms-azuretools.vscode-docker"
    "vincaslt.highlight-matching-tag"
    "wix.vscode-import-cost"
    "sirtori.indenticator"
    "ms-vsliveshare.vsliveshare"
    "alefragnani.project-manager"
    "ms-mssql.mssql"
    "gruntfuggly.todo-tree"
    "visualstudioexptteam.vscodeintellicode"
    "mongodb.mongodb-vscode"
    "ckolkman.vscode-postgres"
)

# Installation
for ext in ${extensions[@]}; do
    echo $(yellow "INSTALLING $ext...")
    code --install-extension $ext
    echo $(green "DONE INSTALLING $ext!")
done