+353-1-416-8900REST OF WORLD
+44-20-3973-8888REST OF WORLD
1-917-300-0470EAST COAST U.S
1-800-526-8630U.S. (TOLL FREE)

Visual Studio Code. End-to-End Editing and Debugging Tools for Web Developers. Edition No. 1

  • Book

  • 192 Pages
  • October 2019
  • John Wiley and Sons Ltd
  • ID: 5839249

Expert guidance on using Visual Studio Code for editing and debugging your web development projects

Visual Studio Code, a free, open source, cross-compatible source code editor, is one of the most popular choices for web developers. It is fast, lightweight, customizable, and contains built-in support for JavaScript, Typescript, and Node.js extensions for other languages, including C++, Python, and PHP. Features such as debugging capability, embedded Git control, syntax highlighting, code snippets, and IntelliSense intelligent code completion support - several of which set it apart from the competition - help make Visual Studio Code an impressive, out-of-the-box solution.

Visual Studio Code: End-to-End Editing and Debugging Tools for Web Developers helps readers to become familiar with and productive in Visual Studio Code. This up-to-date guide covers all of the essential components of the software, including the editing features of the workspace, advanced functionality such as code refactoring and key binding, and integration with Grunt, Gulp, NPM, and other external tools. New users, experienced developers, and those considering moving from another developer tool will benefit from this book’s detailed, yet easy-to-follow information on Visual Studio Code. This book:

  • Teaches readers how to use Visual Studio Code to do full-stack development
  • Explains the steps to install Visual Studio Code on Windows, Mac and Linux platforms
  • Provides a foundation for non-users considering moving to Visual Studio Code
  • Helps current users expand their knowledge of the tool and its available extensions
  • Describes how to open a .NET Core project and get end-to-end execution and debugging functionality  

Visual Studio Code: End-to-End Editing and Debugging Tools for Web Developers is an invaluable guide for both professional and hobbyist web developers seeking immediately-useful information on Visual Studio Code.

Table of Contents

Introduction xv

Chapter 1: Introducing Visual Studio Code 1

Getting Started 1

Installing Visual Studio Code 2

Windows 2

Linux 6

macOS 10

How Cross-Platform Works 11

Summary 12

Chapter 2: Exploring the User Interface 13

Editors 14

Activity Bar 15

Editing Settings Manually 17

Status Bar 18

Other Windows 23

Command Palette 23

Terminal Window 24

Output Window 25

Debug Console 26

Problems Window 27

Summary 29

Chapter 3: Files and Folders and Projects (Oh My) 31

Explorer 31

Project View 32

Decorations 36

Workspaces 37

Saving the Workspace 37

Adding Folders 38

Settings 38

Search 38

Advanced Searches 39

Regular Expression Matching 39

Specifying Files 40

Replacing Text 41

Settings 41

Summary 42

Chapter 4: Editing Code in Your Language of Choice 43

Editor Area 43

Editor Groups and Layouts 45

Open Editors 48

Outline View 51

Editing Functionality 52

Keyboard Shortcuts 53

Choosing Your Language 57

Formatting 58

Code Writing Assistance 59

IntelliSense 61

Method Info 61

Completions 62

Settings 62

Find and Replace 63

Minimap 64

Code Snippets 65

Multiple Cursors 67

Auto Save 67

Hot Exit 68

Editor Settings 68

Summary 71

Chapter 5: Integrating with Source Control 73

Source Control Management 73

Using Git 75

Cloning a Repository 76

Staging and Committing 76

Branches 77

Working with the Tracking Branch 78

Merge Conflicts 80

Miscellaneous Support 82

Git Output 82

Default Git Editor 83

Git Diff Tool 83

Other SCMs 83

Installing the Extension 84

Configuring the Extension 85

Summary 86

Chapter 6: Debugging Code 87

Debugging Node.js 87

Launching the Session 88

Launch Configurations 89

Launch vs. Attach Execution 91

Adding a Configuration 92

Simultaneous Configurations 94

Debug Actions 95

Breakpoints 95

Stepping through Code 97

Data Inspection 97

Advanced Launch Configuration 98

Variable Substitution 98

Launching a Browser on Debug 99

Summary 100

Chapter 7: External Tools and Task Automation 101

Tasks Defined 101

Creating Custom Tasks 104

Compound Tasks 106

Problem Matchers 107

Multiline Matchers 108

Background Patterns 109

Advanced Task Configuration 110

Platform-Specific Properties 110

Variable Substitution 110

Summary 112

Chapter 8: Unit Testing 113

Testing a Unit 113

Python Unit Testing 114

Unittest Framework 115

PyTest Framework 116

JavaScript Unit Testing 118

Jest Extension 118

Refactoring 121

Code Actions 122

Summary 124

Chapter 9: Working with Extensions 125

Extension Marketplace 126

Searching for Extensions 127

Installing Extensions 129

Extension Configuration 133

Updating Extensions 136

Workspace Extensions 137

Command-Line Interface 138

Useful Extensions 138

Linters 139

Keyboard Mappings 139

Snippets and Coding Assistance 140

Miscellaneous Tools 140

Summary 142

Chapter 10: Creating Your Own Extensions 143

Getting Started 143

An Extension Project 147

Activation Event 148

Contribution Points 148

Visual Studio Code API 149

Extension Project Structure 149

Activation Events 151

onCommand 151

onDebug 152

onFileSystem 152

onLanguage 153

onUri 153

onView 154

onWebviewPanel 154

workspaceContains 155

Start Up 155

Contribution Points 155

breakpoints 156

colors 156

configuration 157

configurationDefaults 157

commands 158

debuggers 158

grammars 158

jsonValidation 159

keybindings 159

when Clause 159

languages 160

menus 160

problemMatchers 162

snippets 162

taskDefinitions 163

themes 163

viewsContainers 163

views 164

Visual Studio Code API 165

Common Patterns 165

Promises 165

Cancellation Tokens 165

Events 165

Commands 166

Debug 166

Env 166

Extensions 167

Languages 167

Scm 168

Tasks 168

Window 168

Workspace 169

Summary 169

Index 171

Authors

Bruce Johnson