Skip to content

Visual Studio Code extension for editing YarnSpinner files

License

Notifications You must be signed in to change notification settings

TranquilMarmot/YarnLoom

Repository files navigation

Yarn Spinner Loom Visual Studio Code Extension

Yarn Loom Logo

Yarn Loom is a Visual Studio Code extension for editing yarn files. It is a re-imagining of the Yarn Editor built from the ground up to integrate seamlessly with Visual Studio Code.

demo video

Continuous Integration

Installing

This extension can be installed from the Visual Studio Code Extension Marketplace

Usage

Once the extension is installed, simply open up a .yarn or a .yarn.txt file to use it!

Reporting Issues/Bugs, Contributing, and Technical Details

If you find any issues or bugs with this extension, please open up a new issue on the GitHub repo and include as much detail as possible!

For in-depth technical details on how this extension works, and how to contribute to it yourself, see CONTRIBUTING.md.

How To

Each of the examples below has an expandable gif that shows the editor in action.

Editing nodes

To edit a node, double click it. This will open the node up in a text editor next to the open .yarn file.

Changes saved in this text editor will be reflected in the .yarn file editor. Saving the open .yarn file will persist changes to disk, and undo/redo can be used to move back and forth between edits to a node.

Expand for demo of editing nodes Demo of editing a node

Renaming nodes

A node can be renamed by clicking on the rename icon (rename icon)

Any nodes that are linking to a node will have their links automatically updated when a node is renamed.

An error message will be shown if there is already a node with the entered name.

Expand for demo of renaming a node Demo of renaming a node

Changing node tags

Tags can be added/removed by clicking the add icon (add icon) on the bottom of a node.

Existing tags will be shown in a list and can be toggled on and off.

To add new tags, click the "+ Add Tags" button. You can then enter a list of space-separated tags here and they will all be added to the node.

Expand for demo of changing node tags Demo of editing a node's tags

Changing a node's color

Node colors can be changed by clicking the color change icon (color change icon).

This will bring up a list of colors to choose from. The colorID that you see when opening a node in the text editor corresponds to a color in this list.

Expand for demo of changing a node's color Demo of editing a node's color

Changing a node's position

A node's position can be changed by dragging it around in the graph view of the .yarn file.

Expand for demo of changing a node's position Demo of move nodes around in the graph editor

Adding new nodes

New nodes are added automatically when you link to them when editing node text.

You can also add new nodes by opening up the node list, scrolling to the bottom, and clicking "Add new node".

Expand for demo of adding a new node Demo of adding a new node

Deleting nodes

Nodes can be deleted by clicking the garbage can/trash icon in the their title (garbage can icon) . A confirmation message will be displayed.

Expand for demo of deleting a node Demo of deleting a node

Searching

The search bar can be used to search for specific nodes.

When searching, nodes that do not contain the search term will be dimmed. Nodes containing the search term will stay opaque.

The "Title", "Body", and "Tags" buttons in the search bar control whether or not to search within node titles, bodies, and tags, respectfully. This is an "or" search, so if searching in all three locations and one node has "Sally" in the title, one has "Sally" in the body, and one has a tag of "Sally", then all three will show up in the search. Note that turning off all three options effectively disables the search.

There are also two buttons to enable/disable case sensitivity (case sensitive icon) and regular expressions (regular expression icon). Regular expressions are only run on enabled search contexts ("Title", "Body", and/or "Tags") and are done via JavaScript's built-in RegExp functionality, so anything regular expressions that work in JavaScript will work. The MDN Web Docs have a nice regular expression cheat-sheet available.

Expand for demo of searching for nodes Demo of searching for nodes

Quick tag search

To quickly search for a tag, you can either click on it in the footer of a node or expand the tag list and select it from there. This will automatically fill in the search box with the tag and limit the search to tags.

Re-selecting the tag that is currently being searched for will de-select it and reset the search box.

Expand for demo of quick tag searching Demo of quickly searching for tags

Switching between the graph editor and a text editor

Switching editors can be done with the command palette, Ctrl + Shift + P, and selecting the "View: Reopen Editor With..." option.

In this menu, selecting "Configure default editor for '*.yarn'..." will let you set the default editor for .yarn files. This is useful if you want Visual Studio Code to default to opening files with the text editor.

Expand for demo of switching between the text editor and Yarn Loom Demo of switching between Yarn Loom and a text editor

Theme support

This extension should fully support all Visual Studio Code themes. Better and more integrated theme support will be added gradually.

If there is a theme where something doesn't look right or is unreadable, please don't hesitate to open up a new issue on the GitHub repo.

Expand for demo of switching themes Demo of switching themes in Visual Studio Code

Keyboard Shortcuts

Shortcut Description
Ctrl + F Focus on search bar
Shift + + Add new node

Special Thanks

The syntax highlighting portion of this extension was copied over from the Yarn VSCode Extension and all credit for it goes to @desplesda.

Portions of Yarn file parsing and in-editor highlighting were copied over from the Yarn Editor and all credit for it goes to the Yarn Editor contributors, but especially @blurymind.

The original Yarn Spinner logo was made by Cecile Richard and was remixed to create the logo for this extension.