Chapter 3 Installing Visual Studio Code
Visual Studio Code (VSCode) is a powerful, free code editor that works excellently with R, Quarto, and GitHub Copilot. Let’s get it installed!
What you’ll accomplish in this chapter:
- ✅ Download and install VSCode
- ✅ Install essential extensions for R and Quarto
- ✅ Configure VSCode for this course
- ✅ Test that everything works
3.1 Step 1: Download VSCode
3.1.1 For Windows Users
- Go to https://code.visualstudio.com
- Click the large “Download for Windows” button
- The download will start automatically (file:
VSCodeUserSetup-x64-*.exe)
3.1.2 For macOS Users
- Go to https://code.visualstudio.com
- Click the large “Download for Mac” button
- The download will start (file:
VSCode-darwin-universal.zip)
Apple Silicon (M1/M2/M3) vs Intel:
The universal download works for both! If you want a specific version:
- Apple Silicon (M1/M2/M3): Choose “Apple Silicon”
- Intel Macs: Choose “Intel Chip”
Not sure which you have? Click Apple menu () → About This Mac. If it says “Apple M1” or “M2” or “M3”, you have Apple Silicon.
3.1.3 For Linux Users
- Go to https://code.visualstudio.com/Download
- Choose your distribution:
- .deb (Debian/Ubuntu)
- .rpm (Fedora/Red Hat)
- .tar.gz (Generic Linux)
3.2 Step 2: Install VSCode
3.2.1 Windows Installation
- Locate the downloaded file (usually in
Downloadsfolder) - Double-click
VSCodeUserSetup-x64-*.exe - Accept the license agreement
- Click “Next” through the installer
- Important: On the “Select Additional Tasks” screen, check these boxes:
- ✅ Add “Open with Code” action to Windows Explorer file context menu
- ✅ Add “Open with Code” action to Windows Explorer directory context menu
- ✅ Add to PATH (requires shell restart)
- Click “Install”
- Wait for installation to complete (about 1-2 minutes)
- Click “Finish” and launch VSCode
Permission prompt:
Windows may ask “Do you want to allow this app to make changes to your device?” Click “Yes” to continue.
3.2.2 macOS Installation
Locate the downloaded .zip file (usually in
Downloadsfolder)Double-click to extract it → You’ll see
Visual Studio Code.appDrag
Visual Studio Code.appto yourApplicationsfolderLaunch VSCode from Applications or Spotlight (⌘+Space, type “Visual Studio Code”)
“Visual Studio Code.app” can’t be opened:
macOS may block apps from unidentified developers. If you see this message:
- Go to System Settings → Privacy & Security
- Scroll down to find the message about VSCode
- Click “Open Anyway”
- Confirm by clicking “Open”
3.3 Step 3: First Launch and Welcome Screen
When you first open VSCode, you’ll see the Welcome screen:
Familiarize yourself with the interface:
- Activity Bar (left side): Access different views (Explorer, Search, Extensions, etc.)
- Side Bar: Shows content from the selected Activity Bar view
- Editor: Where you write code (currently shows Welcome tab)
- Status Bar (bottom): Shows info about your current file
3.4 Step 4: Install Essential Extensions
Extensions add superpowers to VSCode! Let’s install the extensions you need for this course.
3.4.1 4.1 Open the Extensions View
Click the Extensions icon in the Activity Bar (looks like four squares) or press:
- Windows/Linux:
Ctrl+Shift+X - macOS:
⌘+Shift+X
3.4.2 4.2 Install the R Extension
- In the search box, type: “R”
- Find “R” by REditorSupport (it will be the first result)
- Click “Install”
Extension publisher matters!
Make sure the extension is by REditorSupport (the official R extension). It should have a blue checkmark and millions of downloads.
3.4.3 4.3 Install the Quarto Extension
- Search for: “Quarto”
- Find “Quarto” by Quarto.org
- Click “Install”
3.4.4 4.4 Install GitHub Copilot Extension
- Search for: “GitHub Copilot”
- Find “GitHub Copilot” by GitHub
- Click “Install”
You’ll sign into Copilot later!
Don’t worry about signing in yet. We’ll set up Copilot in Chapter 6 after everything else is installed.
3.4.5 4.5 Install GitHub Copilot Chat Extension
- Search for: “GitHub Copilot Chat”
- Find “GitHub Copilot Chat” by GitHub
- Click “Install”
3.4.6 4.6 Install Python Extension (Optional but Recommended)
Even though this is an R course, the Python extension helps with some background tasks.
- Search for: “Python”
- Find “Python” by Microsoft
- Click “Install”
3.4.7 4.7 Install Additional Helpful Extensions
These are optional but recommended for a better coding experience:
| Extension | Purpose | Search Term |
|---|---|---|
| Markdown All in One | Better markdown editing | “Markdown All in One” by Yu Zhang |
| Code Spell Checker | Catch typos in comments | “Code Spell Checker” by Street Side Software |
| indent-rainbow | Visualize code indentation | “indent-rainbow” by oderwat |
| Bracket Pair Colorizer | Color-code matching brackets | Built-in (enable in settings) |
3.5 Step 5: Configure VSCode Settings
Let’s adjust a few settings to optimize VSCode for this course.
3.5.1 5.1 Open Settings
- Windows/Linux:
Ctrl+,(Ctrl+Comma) - macOS:
⌘,(Cmd+Comma)
Or: Click File → Preferences → Settings (on Mac: Code → Settings → Settings)
3.5.2 5.2 Recommended Settings
In the search bar at the top of Settings, type each setting name and adjust:
3.5.2.1 Enable Auto-Save
- Setting:
Files: Auto Save - Value:
afterDelay - Why: Automatically saves your work every few seconds
3.5.2.2 Format on Save
- Setting:
Editor: Format On Save - Value: Check the box (✅)
- Why: Keeps your code neat and readable
3.5.2.3 Font Size
- Setting:
Editor: Font Size - Value:
14(or your preference, 12-16 is typical) - Why: Easier on the eyes
3.5.2.4 Word Wrap
- Setting:
Editor: Word Wrap - Value:
on - Why: Long lines wrap instead of scrolling horizontally
3.5.2.5 Enable Bracket Pair Colorization (Built-in)
- Setting:
Editor: Bracket Pair Colorization - Value: Check the box (✅)
- Why: Makes nested code easier to read
Want to customize more?
You can change the color theme (File → Preferences → Color Theme), icon theme, and much more. Explore the settings when you have time!
Popular themes for coding: - Dark themes: Dark+ (default), One Dark Pro, Dracula - Light themes: Light+ (default), Solarized Light
3.6 Step 6: Test Your VSCode Setup
Let’s make sure everything is working!
3.6.1 6.1 Create a Test R Script
- Click File → New File (or
Ctrl+N/⌘+N) - VSCode will ask “Select a language” → Type “R” and press Enter
- Type this simple R code:
# Test script for VSCode
print("Hello from VSCode!")
# Simple calculation
x <- 5
y <- 10
result <- x + y
print(paste("The sum is:", result))- Save the file: File → Save As → Name it
test.R
Syntax highlighting working?
If the R extension is working, you should see:
- Comments (lines starting with
#) in green or gray - Strings (“Hello from VSCode!”) in red or orange
- Numbers (5, 10) in a different color
- Keywords (
<-,print) highlighted
If everything looks plain black text, the R extension may not be active. Try restarting VSCode.
3.6.2 6.2 Run the R Code (We’ll set up R in Chapter 4!)
Don’t worry if this doesn’t work yet!
We haven’t installed R itself yet (that’s in Chapter 4). For now, just confirm that:
- ✅ VSCode opens and runs smoothly
- ✅ You can create and save .R files
- ✅ Syntax highlighting works
- ✅ Extensions are installed
We’ll come back and test code execution after installing R!
3.7 Video Tutorial: Installing and Setting Up VSCode
Video Tutorial:
Watch directly on YouTube: VS Code Tutorial for Beginners
3.8 Summary Checklist
Before moving to the next chapter, make sure you have:
Troubleshooting:
VSCode won’t open: - Try restarting your computer - Check that you have administrator permissions - Re-download and reinstall
Extensions won’t install: - Check your internet connection - Restart VSCode and try again - Make sure you’re searching for the exact extension name
Still stuck? Reach out via email or office hours!