Visual Studio Code Cheat Sheet
Table of contents
- Install Visual Studio Code
- Install Visual Studio Code on macOS using Homebrew
- Enable Profiles for Different Programming Languages
- Install and Configure Extensions Per Profile
- Store VS Code Configurations in the Cloud
- Configure Language-Specific Settings
- Configure Workspaces for Specific Projects
- Using Dev Containers for Full Isolation
- Automate Setup on a New Machine
- Uninstall VS Code
Install Visual Studio Code
Download and install VS Code from the official website:
👉 https://code.visualstudio.com/
Install Visual Studio Code on macOS using Homebrew
Ensure Homebrew is Installed
Open Terminal (Cmd + Space → Type Terminal → Press Enter) and run:
brew --version
If Homebrew is not installed, install it with:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then, restart your terminal.
Install Visual Studio Code
Run:
brew install --cask visual-studio-code
Verify Installation
Check if VS Code is installed:
code --version
If VS Code doesn’t open, restart your terminal and try again.
(Optional) Add code Command to PATH
If the code command doesn’t work, add it manually:
ln -s "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" /usr/local/bin/code
Now, you can open VS Code from the terminal using:
code .
(Optional) Install Useful Extensions via Homebrew
You can install VS Code extensions directly from Homebrew:
code --install-extension ms-python.python
code --install-extension esbenp.prettier-vscode
code --install-extension dbaeumer.vscode-eslint
Enable Profiles for Different Programming Languages
VS Code introduced Profiles, which allow you to customize extensions, settings, and UI layout per profile.
Steps to Create a Profile
- Open VS Code.
- Press Ctrl + Shift + P (or Cmd + Shift + P on macOS) to open the command palette.
- Type and select “Profiles: Create a Profile”.
- Name your profile based on the programming language (e.g., Python Dev, Web Dev, Java Dev).
- Choose what to include in the profile:
- Settings (Language-specific settings)
- Extensions (Only relevant plugins)
- Keybindings
- UI State (Theme, layout, etc.)
Switching Between Profiles
- Press Ctrl + Shift + P (or Cmd + Shift + P on macOS) then type “Profiles: Switch Profile”.
- Select your desired profile.
Install and Configure Extensions Per Profile
Each profile can have its own set of extensions.
Example: Recommended Extensions Per Language
- Python Profile
- Python (
ms-python.python) - Pylance (
ms-python.vscode-pylance) - Jupyter (
ms-toolsai.jupyter) - Black Formatter (
ms-python.black-formatter)
- Python (
- Web Development Profile
- Live Server (
ritwickdey.LiveServer) - Prettier (
esbenp.prettier-vscode) - ESLint (
dbaeumer.vscode-eslint) - Tailwind CSS IntelliSense (
bradlc.vscode-tailwindcss)
- Live Server (
- Java Profile
- Java Extension Pack (
vscjava.vscode-java-pack) - Maven (
vscjava.vscode-maven) - Debugger for Java (
vscjava.vscode-java-debug)
- Java Extension Pack (
To install extensions per profile:
- Switch to the desired profile.
- Open Extensions (
Ctrl + Shift + X). - Search and install relevant extensions.
Store VS Code Configurations in the Cloud
To sync your settings, themes, keybindings, and extensions:
Enable Settings Sync
- Open VS Code.
- Press Ctrl + Shift + P (or Cmd + Shift + P on macOS), then search for “Settings Sync: Turn On”.
- Sign in with:
- GitHub
- Microsoft Account
- Choose what to sync:
- Settings
- Extensions
- Keybindings
- UI State
- Snippets
Note: Settings are stored in the cloud and can be restored on any new device.
Using GitHub to Store Configuration
If you want more control:
- Go to
C:\Users\YourUsername\AppData\Roaming\Code\User(Windows) or~/.config/Code/User(Linux/macOS). - Backup
settings.json,keybindings.json,snippets, andextensions.jsonto a private GitHub repository.
Example Git commands:
git init
git add .
git commit -m "Backup VS Code Config"
git remote add origin https://github.com/yourusername/vscode-config.git
git push -u origin main
Configure Language-Specific Settings
VS Code allows per-language settings. To do this:
- Open
settings.json(Press Ctrl + Shift + P (or Cmd + Shift + P on macOS) → “Preferences: Open Settings (JSON)”). - Add settings specific to a language.
Example: Different Formatting Per Language
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
}
Configure Workspaces for Specific Projects
For team projects or specific settings per folder:
- Open a project folder in VS Code.
- Create a
.vscodefolder inside the project directory. - Add a
settings.jsonfile inside.vscode.
Example:
{
"editor.tabSize": 4,
"editor.formatOnSave": true,
"python.analysis.typeCheckingMode": "basic"
}
Now, these settings only apply inside this project.
Using Dev Containers for Full Isolation
If you want completely separate environments per language, use Dev Containers.
Steps:
- Install Dev Containers extension (
ms-vscode-remote.remote-containers). - Create a
.devcontainer/devcontainer.jsonfile in your project. - Define the container with the language dependencies.
Example for Python:
{
"name": "Python Dev",
"image": "mcr.microsoft.com/devcontainers/python:3.10",
"extensions": ["ms-python.python", "ms-toolsai.jupyter"]
}
Now, when you open the project, it runs inside a containerized environment.
Automate Setup on a New Machine
To restore everything quickly on a new machine:
- Install VS Code.
- Enable Settings Sync.
- Clone your GitHub settings backup (if applicable).
- Install all necessary profiles and extensions.
Uninstall VS Code
Uninstall using Homebrew
If you installed VS Code using Homebrew, run:
brew uninstall --cask visual-studio-code
To confirm it’s gone, check:
brew list --cask | grep visual-studio-code
If it’s still listed, force remove it:
brew uninstall --cask --force visual-studio-code
Delete Configuration Files and Cache
Even after uninstalling, VS Code leaves behind settings, extensions, and cache. Remove them manually:
Delete VS Code User Data
rm -rf ~/Library/Application\ Support/Code
Delete VS Code Extensions
rm -rf ~/.vscode
Delete Cache Files
rm -rf ~/Library/Caches/com.microsoft.VSCode
rm -rf ~/Library/Caches/com.microsoft.VSCode.ShipIt
Remove Logs
rm -rf ~/Library/Logs/Code
Remove Saved Application State
rm -rf ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState
Verify VS Code is Fully Removed
Run:
ls ~/Library/Application\ Support/ | grep Code
ls ~/.vscode
If nothing appears, VS Code is completely removed.
Remove Homebrew Cask Data (Optional)
To ensure all traces are removed from Homebrew:
brew cleanup
Restart Your Mac (Recommended)
This ensures no background processes are running from VS Code.