LiminaliaLiminalia
Technical docs: How Studio works: Check

Check

Open in Claude (new tab)

Check, when there are no problems (errors, warnings, information) and no lines unreached by the all-routes test, doesn’t line up cards showing 0; it shows just a “No problems” line, “Check again,” and running the all-routes test (or its result if it has been run). If something was found, three cards appear at the top (“All-routes test” (POST /coverage) with the share of lines reached and “Run again,” “Problems” with the count and the breakdown of errors and warnings, and the first range under “Unreached”; zero counts in the breakdown are gray), and below them round buttons with counts for the categories (Syntax, Commands and parameters, Characters, Jump targets, Assets, Plugins) and the list of problems. The syntax check runs automatically on every save (it uses the whole-project check the write API runs once after saving, so the client doesn’t check again; opening and “Check again” use POST /check). Click a category to show only its problems (choose as many as you like; click again to remove). Click any problem to go to that line in the script (problems in cast.json go to that character or sprite set on the Characters screen; suggested fixes are also shown in the interface language). The badge on “Check” in the top bar is the same number as the “Problems” card (errors and warnings, adding those found by the all-routes test, the overflow check and test play, and counting the same file, line and code once; client/model/problems.ts). It’s red when there are errors and yellow when there are only warnings. Writing suggestions (sprite flicker, gaps in sound, values equal to the defaults and so on; SUGGESTION_CODES in lang) aren’t counted in the badge or “Problems”; the card lists them separately as “Suggestions.” The check is the same as lim check, the VS Code extension and the MCP check_text (projectDiagnostics in @liminalia/sdk builds the input in one place; it also checks translation files, the script format version and jump targets from command data). After a recheck and after outside changes (scripts, cast.json, liminalia.json, translation files, project data), the problem count in the script header, the marks in the scene list and tabs, the squiggles on lines, and the line state and route are all rebuilt from the new result. The category counts are split into errors (red), warnings (yellow) and information (uncolored), showing only the ones there are (0 if none; hover for the breakdown; the total is in the button’s data-count). Problems whose suggested fix can be applied as is (the diagnostic’s fix: candidates with similar spellings for commands, parameters, labels, characters, variants and so on, assets with similar names, punctuation) are fixed with “Fix” on the right of the line. In the editor, “Replace with ”…"" and “Delete this line” in the problem’s tooltip apply the same fix. For unneeded @cg-unlock, punctuation, parameters equal to the project default (same-as-default), fades that can be one @scene-change (scene-change-candidate, which merges several lines into one) and unused lim-ignore, the count and “Delete all” or “Fix all” for each kind appear above the list (applied after you confirm). For warnings and info, “Don’t show on this line” in the menu of the problem’s tooltip and of a row in the list (right-click and ”…”) writes // lim-ignore code on the line before (or adds the code to a lim-ignore right above; ⌘Z undoes it), and “Don’t show this kind” writes off for that code in check.severity in liminalia.json (turn it back on with “Undo” on the notification or under Check in the project settings; “Silencing diagnostics” in format.md). If a diagnostic’s fix is a Studio fix (ProjectFix in client/fix-actions.ts), Studio carries it out instead of rewriting the line. { kind: "add-speaker", name } is “Add X as a character” (like “Add” on the Characters screen, it makes a character without sprites in cast.json and adds it to speakers), and { kind: "create-scene", label, file? } is “Add the scene #X” (like “Add scene” in the scene list, it adds # X at the end of file, or the diagnostic’s file if it’s left out). The button says what it does, and the same action runs from the check list, the tooltip in the code view and the problem card in the block view. When a diagnostic has both a Studio fix and a rewrite of the line (such as replacing with a name of similar spelling), every screen offers the Studio fix first (the order recommended in fixes), and the rewrite of the line can be chosen too (two buttons in the code view’s tooltip and on the problem card, and the row’s menu in the check list). Fixes are applied the same way as replace in all files: the open file receives editor changes (⌘Z undoes them), and other files go through the write API (kept in the change history). Lines that changed after the check are skipped. “Delete all,” “Fix all” and “Fix” remember all the files they changed as one action, and “Undo” in the notice undoes them all at once (the same as replace in all files). Runtime problems found in test play (see “Test play tools” above) are gathered in the “Found in test play” category and counted in the number of problems and the badge (they’re cleared when a new test play opens). The all-routes test runs each file up to 8 times, widening to ways of choosing not tried yet (it stops early when every way of choosing has been tried; the same as lim coverage; “Covering every branch” in ci.md). The all-routes test also warns about destinations that plugin commands reported to the flowchart but that never appeared as a choice when run without a screen (since neither route search nor the all-routes test can get past them; plugins.md). While running, the all-routes test card (the “No problems” line when there are no problems) shows “Run N of M (file),” a progress bar and “Stop” (POST /coverage/stream, which sends progress after each run; onProgress and signal of coverage in @liminalia/runtime). If it fails, the reason appears in a notice and on the card. The result is saved in .liminalia/coverage.json with the hashes of the files at the time of the run (not when stopped), and shown again after reopening (GET /coverage; the flowchart’s Unreached and the endings panel use it too). If the script changed after the saved result (a different content hash, or a file that is gone), the card says “N files changed after the run” (hover to see the names of the changed files). The result also records the engine version and a hash of what changes the run besides the scripts (liminalia.json, cast.json, the project data and the plugin commands). If the version differs from the current one (including results saved before the version was recorded), or those changed after the run, GET /coverage adds outdated and the screen doesn’t show it as the current result (the percentage is dimmed, with “This result is from an earlier version of Liminalia” or “Project settings, characters, or data changed after the run” and a prompt to run it again; it isn’t rerun automatically because the all-routes test is heavy on large projects). It is checked again when characters, settings or data change outside. Below the list of problems (the “No problems” line when there are none) and the number of endings is “Find overflowing pages.” Click it to turn every text page of every script (dialogue and narration, including inside @if) into the same pieces the runner puts in the message window (characters, ruby, line breaks, decorations such as bold and text size; model/overflow.ts), and have them measured by an invisible player opened off screen (the same device as the preview, with the game settings, theme and project CSS as they are) (stage-measure; the player uses DomHost.measurePages to put the text, without the typing animation, into an invisible copy of the current message window). Pages where the text area needs scrolling, where the message window grows beyond its empty size, or where the message window has a fixed height and the text goes past its inner bottom edge are listed in the check as the warning “Overflows the message window (N lines; it fits M)” (click one to go to that line), and counted in the number of problems and the Check badge. The open file is measured with its content before saving. The original and each translated language (lang/<language>.json; only lines with translations use them, and scene translations contexts and speaker name translations are used just as the runner does) are measured with each language’s player (fonts and text sizes per language), and warnings for translations name the language, as in “The en translation overflows the message window.” When there are translated languages, a selector for the languages to measure (All languages, the original, or each language; the default is all; remembered in that device’s localStorage) appears to the left of the button. Expression values ({= …}) are measured as the characters of a literal string or of a variable with a string initial value (variables in liminalia.json); conditional expressions as the longer of both sides if both are known, or else as 4 full-width characters. Inline images are measured as one square character the height of the image (or the text size if not written). Inline commands and click waits don’t become characters (even when divided by click waits, the text continues in the same message window, so a line is measured as one page). The result isn’t remembered; click again to measure again.

Below that is TODO comments. It lists the comment lines that start with a marker word (TODO, FIXME and XXX by default), such as // TODO: …, from every file (the word, the comment text, and the file and line; click one to go there; letters ignore case, and words followed by more letters or digits, such as TODOS, are left out). It searches with a regular expression through POST /search, the same as search across files, so the open file is searched in its content before saving (model/todos.ts, panes/todos.ts). It searches again when the Check screen opens and after each check. “Marker words” changes the words (separated by commas; leave it empty to go back to the defaults). The words are kept in Studio data (todoWords in .liminalia/studio.json) and aren’t included in the game.

Below that is Measure performance. It is the same measurement as lim profile (POST /profile; “Development tools” in player.md). Choose the start position (“New game” (entry in liminalia.json) or a script file) and the number of pages (30 by default, up to 200), then click “Start measuring,” and it opens the game without showing it and measures while paging through it. While measuring, it shows “Page N of M,” the current position, a progress bar and “Cancel” (nothing is saved if canceled). When done, a single card shows a one-line verdict (“Runs smoothly” if the lowest frame rate is 50 or more and long frames are 1% or less; otherwise, what to look at), the frame rate (average and lowest), long frames (count and the longest), memory (peak, start and end, and the peak number of DOM elements), the number of assets loaded (images, sounds), the assets that took longest to load (5), and the collapsed “Per-page numbers,” noting that it was saved to exports/profile/profile.md and profile.json (the same as lim profile; in the Japanese display, 計測.md and 計測.json). Measuring continues even if you move to another screen. One at a time (asking while measuring returns 409).

Below the list of problems are cards for the character counts (dialogue, narration, choices), dialogue with voices and the number of spelling variant groups, tables of the breakdown by file, scene and speaker, and the list of spelling variant groups (GET /stats; the same tally as lim stats, recounted when the Check screen opens and when the syntax check is fetched again). Click a table row or a spelling variant location to go to that line, and “Exclude” on a spelling variant group adds it to stats.variants.ignore in liminalia.json (text-stats.md). The “Progress” card next to the character count cards shows today’s progress, the share of the character goal, daily progress (14 days) and the estimated play time (“Progress” in text-stats.md).