Skip to content

Show syntax errors in the scripting terminal editor - #80

Closed
rubensworks wants to merge 13 commits into
terminal-ux/3-editing-featuresfrom
terminal-ux/4-feedback
Closed

rubensworks wants to merge 13 commits into
terminal-ux/3-editing-featuresfrom
terminal-ux/4-feedback

Conversation

@rubensworks

@rubensworks rubensworks commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Phase 4 of the scripting terminal UX improvements, stacked on #79 (then #78, then #77).

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

Show syntax errors in the script editor

  • 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, and hovering the line shows the message.
  • The info book text that said the editor can't detect syntax errors is updated (en_us only).

Make the syntax error marker easier to see

  • With only the line number turned red, at half size, the error line was easy to miss, and nothing showed an error that was scrolled out of view.
  • The gutter cell of the error line now gets a light red background, and the scrollbar shows a red tick at the error's position.

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.
  • A "bound member" label next to the card slot: the card's tooltip already shows Member: ..., and there is already a check mark next to the slot.

Testing

  • ./gradlew build passes, including the new unit tests.
  • ./gradlew runGameTestServer: all 22 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 with Claude Code

https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9

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 and position of
the first error in the editor, 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
@coveralls

coveralls commented Oct 17, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 39131969099

Coverage decreased (-1.1%) to 43.008%

Details

  • Coverage decreased (-1.1%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 542 coverage regressions across 6 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

542 previously-covered lines in 6 files lost coverage.

File Lines Losing Coverage Coverage
org/cyclops/integratedscripting/client/gui/component/input/WidgetTextArea.java 272 0.0%
org/cyclops/integratedscripting/client/gui/container/ContainerScreenTerminalScripting.java 156 0.0%
org/cyclops/integratedscripting/inventory/container/ContainerTerminalScripting.java 94 23.53%
org/cyclops/integratedscripting/core/language/LanguageHandlerJavaScript.java 18 57.14%
org/cyclops/integratedscripting/api/language/ILanguageHandler.java 1 0.0%
org/cyclops/integratedscripting/proxy/CommonProxy.java 1 87.5%

Coverage Stats

Coverage Status
Relevant Lines: 3349
Covered Lines: 1582
Line Coverage: 47.24%
Relevant Branches: 1371
Covered Branches: 448
Branch Coverage: 32.68%
Branches in Coverage %: Yes
Coverage Strength: 22.32 hits per line

💛 - Coveralls

claude added 10 commits October 18, 2026 04:56
Only the line number of the error line turned red, which is easy to miss
at its small size, and nothing indicated an error that was scrolled out
of view. Also give the gutter of that line a red background, and mark the
error position on the scrollbar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9
The red background started one pixel right of the editor border and
covered the gutter separator line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018MRyTdV3fSV5Q5NPGep4q9

Copy link
Copy Markdown
Member Author

Replaced by #87: same changes, rebased as one standalone commit.


Generated by Claude Code

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.

3 participants