More than likely you already have Visual Studio Code (VS Code) installed, however, you should walk through this activity to check for updates and to customize your installation.
W01 Setup: Tools – Editing – Visual Studio Code
The purpose of this setup activity is to install VS Code. It is free to install on Mac, Windows, and Linus operating systems. This is the software application that will be used to write and edit code.
Organizations and individual programmers decide on which code editors to use. This course uses VS Code as the primary code editor because it is free, open source, and popular in the industry having a large community of support, development, and extensions.
Activity Instructions
- Install the VS Code editor if you do not already have it installed: Visual Studio Code.
- If you already had VS Code installed, check for updates.
To check for updates in VS Code, use the menu
Help►Check for Updates... -
Add the Live Server extension in VS Code in order to support
local, offline testing of your work in your browser.
Optional Resources
The Live Server (Five Server) by Yannick tool is very similar to Live Server and will also work for this course. So if you have trouble with Live Server, or have already installed Five Server in a previous course, it is another good option.
-
Customize your VS Code installation:
- Turn on format code on save.
Click to expand
- In the VS Code menu bar, click
File ► Preferences ► SettingsYou can always get into the
Settingspanel by pressing the shortcut⌘ ,[Mac] orCtrl ,[Windows/Linux]. - Type
formatin the search box. - Check the box for ☑️
Editor: Format on Save.
- In the VS Code menu bar, click
- Turn on auto save code using the After Delay option.
Click to expand
- Go to
Settingspanel by pressing the shortcut⌘ ,[Mac] orCtrl ,[Windows/Linux]. - Type
auto savein the search box. - In the
Files: Auto Savepanel, change the dropdown menu fromofftoafterDelay.Option: You can set the delay to your preferred time in milliseconds in the
Files: Auto Save Delaysetting.
- Go to
- Turn on auto updating tags.
Click to expand
When modifying a tag, the linked editing feature automatically updates the matching closing tag.
- Go to
Settingspanel by pressing the shortcut⌘ ,[Mac] orCtrl ,[Windows/Linux]. - Type
linked editingin the search box. - Check the box for ☑️
Editor: Linked Editing.
- Go to
- Disable the AI inline suggest tool.
Click to expand
Development tools such as VS Code are designed for professionals and have many features that help professionals write basic lines of code quickly. Unfortunately, when you are first learning to write these basic lines of code, these powerful tools often get in your way and hurt your learning. With that in mind, it is recommended that you disable the VS Code Inline Suggest tool.
- Go to
Settingspanel by pressing the shortcut⌘ ,[Mac] orCtrl ,[Windows/Linux]. - Type
inline suggestin the search box. - Un-check the box for ☑️
Editor > Inline Suggest: Enabled.
- Go to
- You will also use the built-in Visual Studio Code support for Emmet which provides
shortcuts and abbreviations for quickly writing HTML and CSS, significantly speeding up the
coding workflow. You do not need to do anything to enable Emmet, but it is useful to review some of the
common commands.
Examples using Emmet Shorthand
Emmet supports a wide range of abbreviations and features, including:
- Abbreviations for HTML elements: For instance, typing
.containerand pressing Tab generates a <div> element with a class of "container".<div class="container"></div>. - Nesting and Multiplication: You can nest elements by using the > character and make copies using
the
*. For example,ul>li*3followed by Tab will generate a<ul>element with three nested<li>elements.<ul> <li></li> <li></li> <li></li> </ul> - Grouping: Use the
*character to create multiple copies of an element. For instance,ul>li*5>afollowed by Tab will generate a<ul>element with five<li>elements, each containing a<a>element.<ul> <li><a href=""></a></li> <li><a href=""></a></li> <li><a href=""></a></li> <li><a href=""></a></li> <li><a href=""></a></li> </ul>
- Abbreviations for HTML elements: For instance, typing
- Turn on format code on save.
Optional Resources
- VS Code Documentation – code.visualstudio.com
- Using VS Code User Snippets – Video Demonstration
- User-Snippets – code.visualstudio.com
- Emmet – code.visualstudio.com
Getting Help
If you were not able to complete any of these steps, then you are not prepared yet.
Please reach out for help in Microsoft Teams.