VS Code - Setup and Local Development

Projected Time

About 1 hour

Prerequisites

Motivation

Most software is written using text editors. Visual Studio Code (VS Code) is a very popular open-source text editor developed and maintained by Microsoft. Having a good understanding of how to use VS Code will enable you to code and use other text editors with ease. Many developers prefer using VS Code for development because of its flexiblity and user interface. It provides lots of tools to make tasks easier.

Objectives

Participants will be able to:

Specific Things to Learn

Lesson

How to install VS Code and get started (7 min video)

Read through lesson slides Local Development with VS Code

VSCode Tips

Common Mistakes / Misconceptions

Demonstration

Instructor demonstrates in the slide walkthrough how to change the color theme and use various keyboard shortcuts.

Independent Practice

Techtonica staff will assign pairs.

  1. Follow the instructions in the slides for downloading and installing VS Code if it is not already downloaded to your machine.

  2. Using VS Code’s Getting Started manual or other online resources, discover how to:

As you learn how to do these tasks, make a cheat sheet (on paper or in a note on your desktop) to remind you what the shortcuts are.

  1. Add the shortcuts for the following tasks to your cheat sheet:

Challenge

Briefly summarize your findings so you can share with the class.

Check for Understanding

Form small groups and discuss:

TABS vs SPACES

The age-old tabs vs spaces argument is a very heated and hilarious one. Some developers argue that tabs are better for code indentation while others argue that spaces are better. Both arguments are valid with the following points:

By default, VS Code attempts to guess your indentation options depending on the file you open. Indentation guessing can be turned off via: "editor.detectIndentation": false.

Instructions to set up VS Code to use “spaces for tabs, 2 spaces per tabs” as your default for new files:

For Windows Users

For Mac Users

Visual Studio Code now includes an auto-indentation feature — which, as the name suggests, will automatically indent your code on the editor.The auto-indentation feature will automatically indent your code whenever you move a line around or a set of lines around. It will also automatically indent your code when you copy-paste something which will be really useful especially for those who use StackOverflow quite a lot. Auto-indentation on Visual Studio Code is currently disabled by default, and users can add the editor.autoIndent setting to the editor in order to enable it.

Supplemental Materials