Skip to content

Show syntax errors in the scripting terminal editor - #87

Open
rubensworks wants to merge 1 commit into
master-1.21-ltsfrom
terminal-ux-clean/4-feedback
Open

rubensworks wants to merge 1 commit into
master-1.21-ltsfrom
terminal-ux-clean/4-feedback

Conversation

@rubensworks

Copy link
Copy Markdown
Member

Replaces #80, with the same changes as one standalone commit. Phase 4 of the scripting terminal UX improvements, stacked on #86 (then #85).

Problem

A syntax error in a script only became visible once a variable card using it was evaluated, e.g. as an X in a display panel that you then had to hover (see #5). The terminal itself gave no feedback, and the info book said so too.

Changes

  • ILanguageHandler gets a default checkSyntax(Path, String) that returns null, so other language handlers keep working.
  • The JavaScript handler implements it with GraalJS Context.parse, which parses the script without executing it.
  • The server checks the active script once it has been unchanged for 10 ticks, and only re-checks when the content changes. The result goes to the client in a new TerminalScriptingSyntaxErrorPacket.
  • The editor underlines the error position, turns the line number red and gives that gutter cell a light red background, and shows a red tick on the scrollbar at the error's position, so an error that is scrolled out of view is still visible. Hovering the line shows the message.
  • The info book text that said the editor can't detect syntax errors is updated (en_us only).

Validation

In a dev client (clientdevbridge), with a missing ) on line 7 of a 40-line script:

  • Before: nothing in the editor indicates a problem.
  • After: line 7's gutter is red, the ; is underlined, and hovering shows SyntaxError: script0.js:7:23 Expected , but found ;. Typing the missing ) clears all markers.
  • Scrolled down to line 11: before, there was no sign of the error; now the red tick on the scrollbar stays visible.

New unit tests check the result for valid code, a syntax error (line and column), an unclosed block, and that throw new Error(...) isn't executed.

Dropped from the original plan

  • An "unsynced changes" indicator: edits sync every second and on close, so it would show for under a second and doesn't fix a real problem.

Testing

  • ./gradlew build passes, including the new unit tests.
  • ./gradlew runGameTestServer: all 23 tests pass.
  • I didn't add a game test for the server-side debounce, because it needs an open container with a real player connection to observe the packet. The checker itself is covered by the unit tests.

Generated by Claude Code

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 39152695741

Coverage at 44.072% (no base build to compare)

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 3402
Covered Lines: 1641
Line Coverage: 48.24%
Relevant Branches: 1397
Covered Branches: 474
Branch Coverage: 33.93%
Branches in Coverage %: Yes
Coverage Strength: 23.43 hits per line

💛 - Coveralls

Syntax errors only showed up when a variable card using the script was
evaluated somewhere, for example as an error in a display panel. Check
the active script for syntax errors on the server, without executing it,
once it hasn't changed for half a second. Mark the line of the first error
with a red line number and gutter background, mark its position on the
scrollbar, and show its message when hovering it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
@rubensworks
rubensworks force-pushed the terminal-ux-clean/3-editing-features branch from fa706d0 to bf7170f Compare October 18, 2026 18:07
@rubensworks
rubensworks force-pushed the terminal-ux-clean/4-feedback branch from 037897a to 7c6fa71 Compare October 18, 2026 18:07
Base automatically changed from terminal-ux-clean/3-editing-features to master-1.21-lts October 18, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants