-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Debugging with Visual Studio Code
This page contains tips for editing and debugging scratch-gui
, scratch-vm
, scratch-render
, and related repositories using Visual Studio Code, also known as VS Code. This page does NOT contain tips for using Visual Studio, which is a separate development environment with a similar name.
VS Code by itself provides a very basic experience; for a more complete editing and debugging experience you'll need to install some extensions. This section lists some extensions that work well with the Scratch 3.0 repositories.
Please note that the extensions marketplace changes rapidly and this information may be out of date; this is just meant as a starting point.
Extension Name | Extension ID / search term | Notes |
---|---|---|
Code Spell checker | streetsidesoftware.code-spell-checker | |
Debugger for Chrome | msjsdiag.debugger-for-chrome | See below for setup help |
EditorConfig for VS Code | editorconfig.editorconfig | |
EJS language support | digitalbrainstem.javascript-ejs-support | |
ESLint | dbaeumer.vscode-eslint | |
GitLens — Git supercharged | eamodio.gitlens | |
GLSL Lint | cadenas.vscode-glsllint | Specifically for editing shaders in scratch-render
|
HTML CSS Support | ecmel.vscode-html-css | Primarily for scratch-gui
|
Markdown All in One | yzhang.markdown-all-in-one | |
markdownlint | davidanson.vscode-markdownlint | |
Node.js Modules Intellisense | leizongmin.node-module-intellisense | |
npm | eg2.vscode-npm-script | |
Visual Studio IntelliCode | visualstudioexptteam.vscodeintellicode | |
XML | redhat.vscode-xml | |
YAML | redhat.vscode-yaml |
These instructions will focus on debugging in Chrome or Chromium. It should be possible to use other browsers but you'll need different VS Code extensions and at least some of the setup instructions will be different.
Goal: Install all software necessary for a basic Scratch 3.0 debugging experience.
- Install VS Code
- Download: https://code.visualstudio.com/
- Homebrew:
brew cask install visual-studio-code
- Chocolatey:
cinst vscode
- Install Chrome or Chromium
- NOTE: Consider using a different browser from the one you use for regular browsing. It can occasionally be nice to restart the browser for debugging purposes and that can be annoying if it also means closing all your
Stack Overflow and MDNreference tabs. - Download
- Chrome: https://www.google.com/chrome/
- Chromium: https://chromium.woolyss.com/ (WARNING: this is an unofficial site)
- Homebrew:
brew cask install google-chrome
orbrew cask install chromium
- Chocolatey:
cinst GoogleChrome
orcinst chromium
- NOTE: Consider using a different browser from the one you use for regular browsing. It can occasionally be nice to restart the browser for debugging purposes and that can be annoying if it also means closing all your
- In VS Code, install the "Debugger for Chrome" extension (search for
msjsdiag.debugger-for-chrome
) - Clone the Scratch 3.0 repositories: see Getting Started
Goal: Get VS Code to pause when the code reaches a debugger
statement you've manually added to the code.
Goal: Get VS Code to pause when the code reaches a breakpoint set through VS Code.