Pardon our dust! Docs for Yarn Spinner for Unity 3.2 and Yarn Spinner for Godot C# are on docs.yarnspinner.dev (the old docs site). Docs for Yarn Spinner for Unity 3.3 (pre-release, out ASAP), Yarn Spinner for Godot GDScript and Yarn Spinner for Unreal Engine (work in progress) are on /docs/ (the new docs site).

YarnYSLSGenerator

generates .ysls.json files for yarn spinner language server integration. scans for YarnCommandBinding resources, _yarn_command_*/_yarn_function_* methods, and registered library commands/functions.
class_name YarnYSLSGenerator
extends RefCounted

Inherits from RefCounted

#Constants

#YSLS_VERSION

const YSLS_VERSION = 2

#Methods

#clear()

func clear() -> void

#find_reachable_files(String)

static func find_reachable_files(yarn_project_path: String) -> PackedStringArray

Parameters

  • yarn_project_pathString

Returns PackedStringArray

#find_scan_root(String)

Find the directory to scan for a .yarnproject file. Starts at the project file's folder and moves up while that folder's tree has no .gd files, but never into a folder that holds another Yarn Project, so unrelated projects next to this one are left alone.
static func find_scan_root(yarn_project_path: String) -> String

Parameters

  • yarn_project_pathString

Returns String

#generate_for_project(String, String)

Generate YSLS for a project. With no scan_root, scans the folder from find_scan_root plus the files from find_reachable_files. Pass "res://" to scan the entire Godot project.
static func generate_for_project(yarn_project_path: String, scan_root: String = "") -> int

Parameters

  • yarn_project_pathString
  • scan_rootString

Returns int

#generate_from_runner(String, Variant)

static func generate_from_runner(yarn_project_path: String, dialogue_runner: Variant) -> int

Parameters

  • yarn_project_pathString
  • dialogue_runnerVariant

Returns int

#generate_ysls_dict()

func generate_ysls_dict() -> Dictionary

Returns Dictionary

#generate_ysls_file_dict()

The .ysls.json as it's written to disk. Functions go under PascalCase "Functions", which ysc needs when it reads a project's "definitions" file to know each function's types. The VS Code extension reads either case.
func generate_ysls_file_dict() -> Dictionary

Returns Dictionary

#generate_ysls_json(bool)

func generate_ysls_json(pretty: bool = true) -> String

Parameters

  • prettybool

Returns String

#save_ysls_for_project(String)

func save_ysls_for_project(yarn_project_path: String) -> int

Parameters

  • yarn_project_pathString

Returns int

#save_ysls(String)

func save_ysls(path: String) -> int

Parameters

  • pathString

Returns int

#scan_dialogue_runner(Variant)

func scan_dialogue_runner(runner: Variant) -> void

Parameters

  • runnerVariant

#scan_directory(String)

func scan_directory(path: String) -> void

Parameters

  • pathString

#scan_for_project(String, String)

func scan_for_project(yarn_project_path: String, scan_path: String = "") -> void

Parameters

  • yarn_project_pathString
  • scan_pathString

#scan_gdscript_file(String)

func scan_gdscript_file(path: String) -> void

Parameters

  • pathString

#scan_library(YarnLibrary)

func scan_library(library: YarnLibrary) -> void

Parameters

#scan_node(Node, bool)

func scan_node(node: Node, recursive: bool = true) -> void

Parameters

  • nodeNode
  • recursivebool

Generated from Yarn Spinner for Godot GDScript 3.3.