How to Set Up Visual Studio Code: Complete Guide
Visual Studio Code (VS Code) is probably the best free code editor out there. It's used by millions of developers, and for good reason - it's powerful, customizable, and works with almost every programming language.
This guide will walk you through setting up VS Code from scratch. By the end, you'll have it configured and ready to code.
Step 1: Download and Install
Download:
- Go to code.visualstudio.com
- Click "Download for Windows" (or Mac/Linux)
- Run the installer
Installation: Use the default options. They're fine for most people. Make sure "Add to PATH" is checked if you want to use VS Code from the command line.
Step 2: First Launch
When you first open VS Code, you'll see a welcome screen. You can close it and start coding, but let's set things up first.
Open a folder: Go to File → Open Folder, and select a folder where you'll keep your projects. Or create a new folder for your code.
Step 3: Install Essential Extensions
Extensions make VS Code powerful. Here are the essential ones:
How to install: Click the Extensions icon (square icon on the left sidebar), search for the extension, click Install.
Must-have extensions:
- Python: If you're coding in Python (by Microsoft)
- C/C++: If you're coding in C++ (by Microsoft)
- Prettier: Code formatter (works with many languages)
- GitLens: Better Git integration
- Live Server: For web development (preview HTML in browser)
Language-specific: Install extensions for whatever languages you're using. VS Code will usually suggest them when you open a file of that type.
Step 4: Configure Settings
Customize VS Code to your preferences:
- Go to File → Preferences → Settings (or press Ctrl+,)
- Search for settings you want to change
- Common settings to adjust:
- Font size: editor.fontSize
- Word wrap: editor.wordWrap (set to "on")
- Auto save: files.autoSave (set to "afterDelay")
- Tab size: editor.tabSize
- Minimap: editor.minimap.enabled (turn off if you don't like it)
Pro tip: You can edit settings as JSON for more control. Click the "Open Settings (JSON)" icon in the top right of the settings page.
Step 5: Set Up Your First Project
Create a file:
- Click the "New File" icon in the Explorer
- Name it (like
hello.pyorindex.html) - Start coding
Run your code:
- Python: Right-click → Run Python File in Terminal
- HTML: Install Live Server extension, right-click → Open with Live Server
- Other languages: Use the terminal (View → Terminal)
Step 6: Learn Keyboard Shortcuts
Keyboard shortcuts make you faster. Essential ones:
- Ctrl+P: Quick open (find files)
- Ctrl+Shift+P: Command palette (do anything)
- Ctrl+`: Toggle terminal
- Ctrl+B: Toggle sidebar
- Ctrl+/: Toggle comment
- Ctrl+D: Select next occurrence (great for renaming)
- Alt+Up/Down: Move line up/down
- Ctrl+Shift+K: Delete line
View all shortcuts: Press Ctrl+K, then Ctrl+S to see the keyboard shortcuts editor.
Step 7: Configure Git (If You Use It)
If you use Git:
- Install Git (if you haven't)
- VS Code should detect it automatically
- Go to Source Control (icon on left sidebar)
- Click "Initialize Repository" if starting a new project
VS Code has great Git integration. You can commit, push, pull, and see diffs all from the editor.
Step 8: Customize Your Theme
Make VS Code look how you want:
- Go to File → Preferences → Color Theme
- Try different themes (Dark+, Light+, Monokai, etc.)
- Install more themes from the Extensions marketplace
Popular themes: One Dark Pro, Dracula, Material Theme, GitHub Theme.
Useful Features
IntelliSense: Auto-completion as you type. VS Code suggests functions, variables, etc. Press Tab to accept suggestions.
Multi-cursor editing: Hold Alt and click to place multiple cursors. Or Ctrl+D to select next occurrence. Great for editing multiple lines at once.
Integrated terminal: View → Terminal opens a terminal in VS Code. You can have multiple terminals open.
Split editor: Right-click a file tab → Split Right to see two files side by side.
Command Palette: Ctrl+Shift+P opens the command palette. You can do almost anything from here - just start typing what you want.
Tips for Productivity
- Use snippets: Type shortcuts to insert code templates (like "for" in Python)
- Install language extensions: They add syntax highlighting, IntelliSense, and debugging
- Use the explorer: Organize your files in folders
- Enable auto-save: Saves automatically so you don't lose work
- Use search: Ctrl+F to find in file, Ctrl+Shift+F to find in all files
Common Issues and Fixes
- Extensions not working: Reload VS Code (Ctrl+Shift+P → "Reload Window")
- Terminal not working: Check that your shell is set correctly in settings
- IntelliSense not working: Make sure you have the language extension installed
- Can't find files: Make sure you've opened a folder (File → Open Folder)
Pro Tip: Sync your settings across computers. Go to File → Preferences → Turn on Settings Sync. Sign in with GitHub or Microsoft, and your settings, extensions, and keybindings sync automatically. Super useful if you work on multiple computers.
Common Questions
Is VS Code really free?
Yes, completely free. It's open source and maintained by Microsoft. There's no paid version - everything is free.
Can I use VS Code for any programming language?
Pretty much. Install the extension for your language, and VS Code will work with it. It supports Python, JavaScript, C++, Java, Go, Rust, and many more.
Do I need to know command line to use VS Code?
Not really. You can do most things through the interface. But knowing basic command line helps, especially for running code and using Git. The integrated terminal makes it easy to learn.
Start Using VS Code
VS Code is ready to use. Install the extensions you need, customize the settings, and start coding. The more you use it, the more you'll discover. It's a powerful tool, and learning it will make you a more productive programmer.