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 .yarn files
  • 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

  1. Open VS Code
  2. Open the Extensions panel (Cmd+Shift+X on Mac, Ctrl+Shift+X on Windows/Linux)
  3. Search for Yarn Spinner
  4. 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.

  1. Create a new folder for your project
  2. Open it in VS Code (File → Open Folder)
  3. Open the Command Palette (Cmd+Shift+P / Ctrl+Shift+P)
  4. Type Yarn Spinner: Create New Yarn Project and press Enter
  5. This creates a .yarnproject file that tells the extension where to find your scripts

Create Your First Script

  1. Create a new file called Start.yarn
  2. 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.

Next step Scripting Fundamentals Learn about variables, conditions, and flow control.