VS Code is free, runs everywhere and is what most people use. The default setup is fine — a few small changes make it noticeably better.
Resist installing thirty extensions. Five is plenty.
Extensions worth having#
- Python (Microsoft) — if you write Python. Adds running, debugging and IntelliSense.
- Prettier — formats HTML, CSS and JavaScript on save. Ends every argument about spacing.
- ESLint — flags likely JavaScript bugs as you type.
- Live Server — right-click an HTML file, open it in a browser, and it refreshes on every save.
- Error Lens — shows the error next to the line instead of hiding it in a panel. Genuinely useful when you are learning.
Skip icon packs and themes until everything else works. They are fun and they are not why your code will not run.
Settings to change#
Open settings with Ctrl + , (Cmd + , on Mac) and search for each:
- Format On Save → on. Your code tidies itself every time you save.
- Tab Size → 4 for Python, 2 for web files.
- Insert Spaces → on. This prevents Python’s
TabErrorpermanently. - Word Wrap → on. No more horizontal scrolling to read a long line.
- Auto Save → onFocusChange, if you keep forgetting to save.
- Files: Trim Trailing Whitespace → on. Keeps diffs clean later.
Or paste this into the JSON settings file (Ctrl+Shift+P → “Preferences: Open User Settings (JSON)”):
{
"editor.formatOnSave": true,
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.wordWrap": "on",
"files.trimTrailingWhitespace": true,
"files.autoSave": "onFocusChange",
"[javascript]": { "editor.tabSize": 2 },
"[html]": { "editor.tabSize": 2 },
"[css]": { "editor.tabSize": 2 }
}Shortcuts worth memorising#
| Shortcut | Does |
|---|---|
Ctrl + P |
Jump to any file by name |
Ctrl + Shift + P |
Run any command — the most useful key in the editor |
Ctrl + ` |
Open and close the terminal |
Ctrl + / |
Comment or uncomment the selection |
Alt + Up / Down |
Move a line up or down |
Shift + Alt + Down |
Duplicate a line |
Ctrl + D |
Select the next occurrence — rename several at once |
F2 |
Rename a symbol everywhere it is used |
On Mac, swap Ctrl for Cmd.
Working in folders, not files#
Always open a folder (File → Open Folder), not a single file. Extensions, the terminal and the debugger all work relative to the open folder. Opening a lone file is behind a surprising number of “it does not work” problems.
Running your code#
Python: open the file and press the play button, or use the terminal:
python app.pyWeb: right-click your HTML file and choose “Open with Live Server”. Opening the file directly with a file:// path works for simple pages but blocks fetch requests, which causes confusing errors later.
The integrated terminal#
Press Ctrl + ` to open a terminal already in your project folder. Learning a few commands here saves a lot of clicking:
ls # list files (dir on Windows cmd)
cd folder # go into a folder
cd .. # go up one level
python app.py
git statusQuestions people ask#
Is VS Code better than PyCharm?
Different, not better. PyCharm has deeper Python tooling; VS Code is lighter and handles every language you are likely to touch. Either is a good choice.
Should I use the AI features?
Inline suggestions are the ones most likely to short-circuit learning. Many beginners do better with them off for the first month. See AI coding tools for beginners.
My formatting is not happening on save
Check that a formatter is installed for that file type, and that VS Code knows which one to use — Ctrl+Shift+P → “Format Document With…” → Configure Default Formatter.
Where to go next#
- Git and GitHub explained
- Browser DevTools for beginners
- VS Code problems beginners hit — when the editor is the problem