Setting Up the Editor
Now that you’ve learned the basics of Yarn in Try Yarn Spinner, it’s time to set up a proper editing environment. Yarn Spinner for Visual Studio Code is our full-featured editor for writing Yarn scripts.
Why VS Code?
Try Yarn Spinner is great for experimenting, but for real projects you’ll want:
- Multi-file projects — split your dialogue across multiple
.yarnfiles - Graph view — visualise how your nodes connect
- Syntax highlighting and autocomplete — write faster with fewer mistakes
- Live preview — test your dialogue without leaving the editor
- Debugging — set breakpoints and step through your scripts
Install Visual Studio Code
If you don’t already have it, download and install Visual Studio Code — it’s free and available for Mac, Windows, and Linux.
Install the Yarn Spinner Extension
- Open VS Code
- Open the Extensions panel (
Cmd+Shift+Xon Mac,Ctrl+Shift+Xon Windows/Linux) - Search for Yarn Spinner
- Click Install on the Yarn Spinner extension
You can also install it directly from the VS Code Marketplace.
Create a Yarn Project
Yarn Spinner for VS Code uses Yarn Projects to manage your scripts.
- Create a new folder for your project
- Open it in VS Code (
File → Open Folder) - Open the Command Palette (
Cmd+Shift+P/Ctrl+Shift+P) - Type Yarn Spinner: Create New Yarn Project and press Enter
- This creates a
.yarnprojectfile that tells the extension where to find your scripts
Create Your First Script
- Create a new file called
Start.yarn - Write some Yarn — try the script from First Steps:
title: Start
---
Narrator: Hi, I'm the narrator for the documentation!
<<jump Adventure>>
===
title: Adventure
---
Narrator: We're going to go on an adventure!
-> OK! Let's go!
<<jump Cave>>
-> I don't want to go on an adventure...
Narrator: Oh, OK then.
===
title: Cave
---
Narrator: Let's look inside the spooky cave...
===
Preview Your Script
Open the Command Palette and type Yarn Spinner: Preview Dialogue to run your script right inside VS Code.
You’re ready to start writing real dialogue. Head to the Scripting Fundamentals to learn about variables, conditions, and more.