1
Introducing Visual Studio Code
WHAT'S IN THIS CHAPTER?
- Installing and getting started with Visual Studio Code
- Understanding the cross-platform components that make up Visual Studio Code
GETTING STARTED
The choice of the editor used by any developer is an incredibly personal one. The reason to pick one over the rest depends on a collection of attributes typically related to the tasks they perform on a daily basis. Developers look for functionality, keystroke shortcuts, code snippets, colorations, and more that allow them to stay productive.
Dislodging developers from their choice is not easy. Any change in editors is going to result in an immediate loss of productivity. After all, it takes time to become familiar with the features offered and have them become a natural part of the coding "flow." As a result, it takes a special level of "better" for a developer to switch editors.
For this reason, the success of Visual Studio Code speaks volumes for its features and functionality. Although it has been officially released for just three years (it left public preview in April 2016), it has quickly become one of the top editors in terms of popularity, competing with Sublime Text, Atom, and UltraEdit for the top spot.
But that doesn't matter to you, the reader. What you care about more is what Visual Studio Code can do to help you be productive. As a developer, it is frequently the small things that make the biggest difference-knowing how to add code with a single keyboard chord, being able to do client and server debugging on your Node.js
project, or language-sensitive code completion. Any, all, or none of those might matter, but the goal of this book is to help you find the five or ten features that matter to you and that will make you excited to use Visual Studio Code.
Installing Visual Studio Code
Visual Studio Code is a cross-platform editor. In this instance, cross-platform means that a version is available to run on Windows (7, 8, and 10), macOS, and Linux. The installation process is similar for each, and the starting point is the same in all cases: https://code.visualstudio.com/Download
. Figure 1-1 shows what the download page looks like presently, but it's naturally subject to change.
FIGURE 1-1
Windows
The most efficient starting point for a Windows installation is to download the desired installer. You have six possible options-three different installers each of which is available in 32-bit and 64-bit formats, divided along two separate attributes. First, you can choose from three installer types-System, User, and Zip:
The second attribute available for the installer has a value of either 32-bit or 64-bit. This refers to the width of the data units supported by the CPU on your device. If you are running 32-bit Windows, choose the 32-bit version of the desired installer. If you are running 64-bit Windows, you can choose either the 32-bit or 64-bit version.
NOTE It will come as a disappointment to some, but this option does not mean that Visual Studio Code is a 64-bit application. It's not. Visual Studio Code is a 32-bit application regardless of whether or not it's running on a 64-bit version of Windows.
For both the System and User Installers, running the installation program provides a similar experience. The following screens make up the installation process:
- Welcome Screen-Describes what you're about to do (that being, installing Visual Studio Code). The description indicates whether you are using the User or System Installer.
- License Agreement-The license agreement for Visual Studio Code is presented. You must accept the agreement before you can install the software.
- Select Destination Location-In this screen, shown in Figure 1-2, you choose the directory into which Visual Studio Code will be installed. The default is different for the User and System versions. For the User installation, it is placed in
C:\Users\<your username>\AppData\Local\Programs\Microsoft VS Code
. For the System installation, it is placed in C:\Program Files (386)\Microsoft VS Code
. The (386) part of the directory is left off if you're running on a 32-bit operating system. FIGURE 1-2
- Select Start Menu Folder-Once you have specified where Visual Studio Code will be installed, you get to identify where the links to the application are placed within your Start menu. The dialog to do this is shown in Figure 1-3. The default folder is Visual Studio Code, but you can provide another name, browse within your existing Start menu folders, or create a new one if you prefer. If you don't want to have any Start menu items added, check the Don't Create A Start Menu Folder checkbox at the bottom left of the dialog.
FIGURE 1-3
- Select Additional Tasks-A number of additional tasks can be performed as part of the installation process. The choices, available on the dialog shown in Figure 1-4, include:
FIGURE 1-4
- Creating a desktop icon that launches Visual Studio Code.
- Adding an Open With Code option to the context menu for Windows Explorer files and directories.
- Registering Visual Studio Code as an editor for any supported file types. This causes Visual Studio Code to appear in the Open With list of options in the context menu in Windows Explorer.
- Add the installation directory for Visual Studio Code to the
PATH
environment variable. This allows Visual Studio Code commands to be invoked from within a command-line tool. Keep in mind that it takes a restart of your computer for any changes to PATH
to take effect.
- Ready To Install-The final step in the installation process, as shown in Figure 1-5, is a summary of the options that you selected on the other screens. If you click Install, the installation commences.
FIGURE 1-5
Linux
The basic steps involved with installing Visual Studio Code on Linux are the same regardless of the distribution you are using:
- Download the appropriate software package.
- Install it using the tools appropriate for your distribution.
However, the specifics within each of these steps do depend on your distribution. The precise instructions for a number of different distributions are described in the following sections.
All of the figures in this section were captured from within Ubuntu, so you might see something slightly different in your own environment. Also, be aware that you need to have a desktop installed in your Linux environment in order to run Visual Studio Code.
Ubuntu and Debian Distributions
The installation flow for Ubuntu or Debian is quite similar to Windows or macOS:
- Open your favorite browser and navigate to
https://code.visualstudio.com/download
. Figure 1-6 shows what this web page looks like. FIGURE 1-6
- Identify the desired installation package and download it. 64-bit and 32-bit versions of Visual Studio Code are available, as well as a gzipped TAR file. Use the version suitable for your platform (that is, not the TAR file).
- You will be prompted for what to do with the file. The dialog is shown in Figure 1-7. Though it might seem like opening with Software Install is the obvious choice, instead select the Save File radio button and click OK.
FIGURE 1-7
- Once the file has been downloaded, open a...