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
BRUCE JOHNSON is a partner at ObjectSharp Consulting. He has spent most of his career in the computer industry, working on projects at the leading edge of Windows technology. Bruce has spoken hundreds of times at conferences and user groups throughout North America. He is a Microsoft Certified Trainer (MCT), and has been recognized numerous times as a Microsoft MVP.