Repository navigation
Diagnostics: parse errors name the JS habit, and every code has a fix page - #42
Merged
Merged
Conversation
Parse errors now carry a code and a column. When the failing line reads like JavaScript, React or Solid, the message appends the .rx it most likely meant: JS_LOCAL (const/let in a component), JS_FUNCTION, JS_RETURN, JS_API (createSignal, useState, ...), ASSIGNMENT (`=`, `+=`, `++` on a source, W-1) and REACTIVE_WRITE_IN_OWNED_SCOPE (`() => x := ...`, W-2). Same `hint` in ref/src/parse.ts and compiler/src/parse.rs; scenario S-parse-hints. guide/diagnostics.md has one section per code (63): why, and the fix, with before/after programs. compiler/tests/diagnostics_page.rs checks that every code the crate emits has a section, every `rx before` gets its code and every `rx after` checks clean. The page ships in @reactivescript/compiler (prepack copies guide/), Vite errors end with each code's link, rx-tsc prints them, and the language server sets codeDescription. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWPJ3SHHnqKDEZWuteB
Member
Author
|
The red Running Generated by Claude Code |
This was referenced Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Ryan · project thread
Errors guide you the way Solid's dev diagnostics do: each code's message carries the repair, and a page for that code explains why and shows a fix.
Parse errors
Parse errors used to give no code and no column, so JavaScript habits got messages like "declaration or markup near …". Now, when the failing line reads like JS, React or Solid, the message names the habit and the
.rxit most likely meant:JS_LOCALconst n = 1/let d = n * 2in a component or at top levelJS_FUNCTIONfunction f() { … }JS_RETURNreturn <p>…</p>in a componentJS_API[n, setN] = createSignal(0),useState, …ASSIGNMENT(W-1)n = n + 1,n += 1,n++in a handlerREACTIVE_WRITE_IN_OWNED_SCOPE(W-2)onClick={() => n := 1}: the arrow needs a braced bodyref/src/parse.tsandcompiler/src/parse.rsshare onehintfunction. Any other parse error isPARSE. The hint goes after the parser's own message, so the rule a scenario matches is unchanged.rxc checkprints parse errors asfile:line:col: error CODE [rule] message. JSON, Vite and the editor get the code, plus a message without thepath: line n:prefix.@reactivescript/compiler's Vite path now reports a parse error as a diagnostic with a code, where it used to report a bareerrorstring.S-parse-hints, which scenario rejections can now match by parse code.guide/diagnostics.md
rx before/rx afterprogram pairs.compiler/tests/diagnostics_page.rschecks that every code the crate emits has a section, that eachbeforegets its section's code, and that eachafterchecks clean.@reactivescript/compiler(prepackcopiesguide/*.mdinto the package).…/guide/diagnostics.md#held_write).rx-tscprints the same links.codeDescription, so the code is clickable in the editor.spec/99-diagnostics.mdlists the new parse codes, andguide/language.mdpoints to the page.Checks
cargo test --release: pass, including the new page test.ref:npm test122/122 scenarios pass.npm run crate342/342 programs agree between the crate andref/.compiler:npm testpasses.npm pack --dry-runincludesguide/.rx-language-server:test/run.js16/16 pass.test/tsc.js3/4: "the shop passes" fails with TS2741 onexamples/shop, and it fails the same way onmain(checked with these changes stashed), so this PR doesn't cause it.cargo test, so the page test runs locally only for now.Not in this PR: separate
why/fixes[]JSON fields with editor quick fixes, exact locations for checker errors (HELD_WRITE points at the handler's line), and fixes in the few checker messages that have none (INVALID_REFRESH_TARGET, INVALID_AFFECTS_TARGET, PRE_OF_NON_REACTIVE, UNKNOWN_COMPONENT, ACTION_CALLED_IN_OWNED_SCOPE). For now this page explains them.Generated by Claude Code