Tools Tutorial menu

VS Code Editor

Visual Studio Code (VS Code) is a free code editor from Microsoft, and the most popular editor among web developers.

Why VS Code?

  • Free, and works on Windows, macOS and Linux
  • Fast and light, even on older laptops
  • Colours your code and suggests completions as you type
  • Thousands of free extensions for every language
  • Built-in terminal and Git support

Download it from the official VS Code website and install it with the default options. On Windows, tick Add "Open with Code" so you can right-click any folder to open it.

Open a Folder, Not a File

Always open your whole project folder with File, Open Folder. The Explorer on the left then shows every file, and features like search and Git work across the project.

Part of the screenWhat it is for
Activity Bar (far left)Explorer, Search, Source Control, Extensions
Side BarThe file tree or the selected tool
EditorWhere you write code, with tabs for open files
Panel (bottom)Terminal, Problems, Output
Status Bar (bottom line)Current branch, errors, language, line number

Shortcuts That Save Hours

Shortcuts are for Windows and Linux. On a Mac, use Cmd instead of Ctrl.

ShortcutAction
Ctrl+PQuickly open a file by name
Ctrl+Shift+PCommand Palette: run any command
Ctrl+SSave
Ctrl+/Comment or uncomment the line
Alt+Up / Alt+DownMove a line up or down
Shift+Alt+DownCopy a line down
Ctrl+DSelect the next copy of the current word
Alt+ClickAdd another cursor
Ctrl+F / Ctrl+HFind / find and replace
Ctrl+Shift+FSearch in all files
Ctrl+BacktickOpen the terminal (the backtick key is under Esc)
Shift+Alt+FFormat the whole document

Learn two new shortcuts each week. In a month you will be noticeably faster.

Emmet: Write HTML Faster

Emmet is built into VS Code. In an .html file, type an abbreviation and press Tab:

Example

text
ul>li.item*3
Output
<ul>
    <li class="item"></li>
    <li class="item"></li>
    <li class="item"></li>
</ul>

Type ! and press Tab in an empty HTML file to get a complete page template.

Useful Extensions

Open the Extensions view (Ctrl+Shift+X), search by name, and click Install.

ExtensionWhat it does
PrettierFormats your code neatly on save
ESLintFinds mistakes in JavaScript
Live ServerOpens your page in the browser and reloads it when you save
PythonPython support, running and debugging
GitLensShows who changed each line and when
Error LensShows errors right next to the line

Only install extensions you need, from well-known publishers. Too many extensions slow down the editor.

Settings

Open settings with Ctrl+,. You can search for any setting, or click the icon at the top right to edit the JSON file directly:

Example

json
{
  "editor.fontSize": 15,
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.wordWrap": "on",
  "files.autoSave": "onFocusChange"
}

These settings make the text bigger, format code each time you save, wrap long lines and save files when you switch away.

The Built-in Terminal

Press Ctrl+Backtick (the key under Esc) to open a terminal inside VS Code, already in your project folder. You can run commands like npm install or git status without leaving the editor. The terminal lesson explains the basic commands.

Exercise

Exercise

Which shortcut opens the Command Palette in VS Code on Windows?

Learn Tools with a teacher

Join the Full Stack Development course at Workownix, online or in Orangi Town, Karachi, and get a certificate.

See the course Ask on WhatsApp