Editing .yarn as text

A .yarn file is plain text. You can always open it in VS Code’s text editor. Tsumugi helps there too, and this help stays free after the trial.

Open as text

  • .yarn files open as text unless you pick the Story Writer.
  • In the Story Writer, click Text to open the file beside it. A change in one shows in the other.
  • Run Tsumugi: Open as Yarn Text from the Command Palette.

To go the other way, click Open in Story Writer (the book icon at the top right).

What you get

  • Colours for Chatterbox: node headers, options, speakers, commands and variables. GML and GameMaker’s .yy files get colours too.
  • Problems: the same checks as the Story Writer, as underlines and in VS Code’s Problems panel. See Problems and checks.
  • Spelling: misspelt words in dialogue, narration and options.
  • Outline: every node in the file, in VS Code’s Outline view and breadcrumbs.
  • Go to Definition on a <<jump>> or <<hop>> opens the node it leads to, in the same file.
  • Folding from a node’s title: to its ===.
  • Comments: ⌘ / turns a line into a // comment and back.

Quick fixes

Click the light bulb on an underlined word or line (or press ⌘ .):

  • A problem’s own fix, when it has one.
  • Change to …: a spelling suggestion.
  • Add … to this game’s dictionary: saved in tsumugi.json, for your whole team.
  • Add … to my words (only on this computer): for every game on this computer.

Tidy style

Format Document tidies the file in Tsumugi’s style: four spaces a step, options one step in, the lines under an option one step more, and no blank lines inside a node. Only spaces and line breaks change, never what the game does.

With Auto-fix style on (the tsumugi.enforceStyle setting), the same tidy happens each time you save. The line you are typing on is left alone.

Test from here

Put the cursor inside a node, right-click, and pick Start the Game Here (when testing). See Testing in GameMaker.