[syntax] Add experimental React JSX in .iris files - #627
Draft
purefunctor wants to merge 5 commits into
Draft
purefunctor wants to merge 5 commits into
purefunctor wants to merge 5 commits into
Conversation
Track the Iris source dialect and elaborate JSX through typed Iris.React helpers. Preserve ordinary PureScript syntax, contextual record checking, component identity, and first-class element helpers. Emit React automatic-runtime imports and executable JavaScript without a generated Iris.React runtime module. Cover source diagnostics, inferred and checked props, fragments, code generation, and dialect invalidation through compiler fixtures. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a0ffe1-6de2-739b-9076-c4092e90ecae
Discover .iris alongside .purs in Spago packages, watch both extensions, and retain FFI ownership across source dialect renames. Reject ambiguous same-stem source files and preserve open editor overlays. Exercise source renames and subsequent FFI edits through workspace notifications and the real CLI watcher. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a0ffe1-6de2-739b-9076-c4092e90ecae
Build a mixed PureScript and Iris workspace with the real CLI, then execute fresh output using Vitest browser mode and pinned React 19 tooling. Verify DOM output, hooks, clicks, rerenders, keyed state preservation, and static versus dynamic fragment key warnings. Keep the React browser tooling separate from compiler snapshot tests. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a0ffe1-6de2-739b-9076-c4092e90ecae
Explain the .iris opt-in, generated React imports, typed component props and children, supported syntax, and existing-binding interoperability limits. Document executable JavaScript output and the compiler and browser verification commands. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a0ffe1-6de2-739b-9076-c4092e90ecae
Compatibility regression reportPackage set ✅ The candidate introduces no compatibility errors.
Introduced errorsNone. Fixed errors (0)None. Warning changes (0 introduced, 0 fixed)Introduced None. Fixed None. Candidate errors (0)None. Candidate warnings (36)
|
Classify tags, component references, qualified prefixes, props, text, and delimiters using the existing LSP legend. Preserve PureScript classifications inside interpolations and cover Unicode ranges, nested JSX, and incomplete tags with an LSP fixture. Document the VS Code file association and semantic-highlighting settings. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-01a0ffe1-6de2-739b-9076-c4092e90ecae
This branch has not been deployed
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.
Purpose
Explore opt-in JSX for PureScript with compiler-owned React integration, while leaving existing
.purspackages unchanged..irismodules participate in the same module graph and emit executable JavaScript importingreact/jsx-runtime, analogous to the existing StyleX integration. No generatedIris.Reactruntime module or downstream JSX transform is required.The built-in
Iris.Reacttypes give custom components ordinary checked record/row props, including open rows and contextual checking. Component definitions enforce stable top-level identity. Builds, Spago source discovery, watch mode, and the language server recognize.irisalongside.purs.The language server supplies standard semantic tokens for JSX tags, component references, namespace qualifiers, props, text, and delimiters, including unfinished tags. Embedded PureScript keeps its existing classifications. No JSX TextMate grammar is required.
Review order
The first four commits separate compiler support and fixtures, build/LSP discovery, Chromium rendering coverage, and the experiment documentation. Targeted readability cleanup is folded into the owning commits. A fifth commit adds JSX semantic highlighting, its LSP fixture, and editor setup documentation.
See
documentation/jsx.mdfor syntax, types, generated output, and interoperability limits. Intrinsic DOM attributes currently accept open records; hooks, a complete DOM schema, and automatic interoperability with React Basic are not provided.Verification
The initial compiler implementation retained its tested tree through the commit rewrite:
cargo check -p functional -p javascript -p lexing -p iris-build -p iris-lsp-workspace --testspassed.just t compiler,just t lowering,just t resolving, andjust t lsppassed with no pending snapshots.The semantic-highlighting follow-up additionally passed:
cargo check -p iris-analysis --testsand all 40 analyzer unit tests.just t lsp, with no pending snapshots and no changes to existing.pursreports.just formatandjust licensescompleted before both pushes with no additional changes.Known draft issues
Oracle review identified two remaining issues, supported by source inspection but not yet reproduced through executed regression sequences:
.purs/.irispair.These behavior fixes remain separate from the completed readability cleanup. This PR is an experiment, not a release-ready React integration.