Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
staging-devin-ai-integration
Bot
force-pushed
the
devin/1785758131-jsx-syntax
branch
from
September 24, 2026 22:28
4ace8b1 to
4061c3b
Compare
staging-devin-ai-integration
Bot
force-pushed
the
devin/1785758131-jsx-syntax
branch
from
October 3, 2026 14:57
ca9d7da to
a269c40
Compare
staging-devin-ai-integration
Bot
changed the base branch from
main
to
devin/1791038588-autofmt-comment-tests
October 3, 2026 14:58
staging-devin-ai-integration
Bot
force-pushed
the
devin/1785758131-jsx-syntax
branch
2 times, most recently
from
October 3, 2026 15:26
94763f6 to
e84bdc8
Compare
…d fix parser edge cases
- Replace the `brace: Option<Brace>` field of `Element` and `Component` with a
`delimiter: NodeDelimiter` enum that holds either the brace of the block syntax or the
real `<`, `>` and closing tag tokens of the tag syntax, instead of synthesizing a brace
- Parse incomplete tags (unterminated open tags, missing closing tags, incomplete
attribute value expressions) with diagnostics instead of failing the whole macro
- Report unquoted text in a tag with a dedicated error
- Fix unbraced `match` nodes directly before a tag
- Only end braced expressions at a `<` for nodes, not for attribute values, so that
`hidden: {a} < b` parses again
- autofmt: find the comments around tags using the tag tokens so that they are kept when
tags are rewritten into the block syntax
staging-devin-ai-integration
Bot
force-pushed
the
devin/1785758131-jsx-syntax
branch
from
October 3, 2026 15:28
e84bdc8 to
85ea1ff
Compare
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.
Summary
Stacked on #5883. Adds a JSX/XML-like tag syntax to
rsx!, freely mixable with the existing block syntax (similar to dioxus-html-macro, but integrated into the one macro). A<token switchesBodyNode::parseinto tag mode:The new parser (
packages/rsx/src/jsx.rs) produces the sameElement/ComponentAST as the block syntax, so templates, hot-reloading, attribute merging, and diagnostics behave identically. Element-vs-component tag names, string-literal text nodes,key, shorthand attributes (<div class>), custom/dashed attributes (data-foo="1","custom-attr"="x"), web components (<my-widget />), component paths/generics (<some::Outlet<R>>, closing tag generics optional), and{..spread}all follow the existing rsx rules. Attribute values must be literals or braced expressions (attr={expr}).Breaking change (
dioxus-rsx): thebrace: Option<Brace>field ofElementandComponentis replaced bydelimiter: NodeDelimiter:BodyNode::first_token_span()returns the<for tags (BodyNode::span()still points at the name).Error handling:
<di,<div cl,<div class=), missing closing tags, and attribute value expressions that don't parse yet (class={foo.}, kept as raw tokens). An unterminated or unclosed tag does not swallow its siblings or its parent's closing tag.closing tag `</dvi>` does not match opening tag `<div>`).text in a tag must be a quoted string literal). A single word directly before a tag (<h1>Hello</h1>) is ambiguous with an element/component that is being typed, so it expands with a diagnostic that suggests quoting it.<>...</>) are rejected with a dedicated error.Supporting changes:
Element::from_parts/Component::from_partsextracted from the existingParseimpls so both syntaxes share the merge/validation logic.ExprNode::parseends a{expr}ormatchnode at a following<, so{children}</div>andmatch x { .. } </ul>parse. This is limited to nodes (which can never be comparisons);PartialExpr::parseis unchanged, so attribute values likehidden: {a} < bstill parse as expressions.dx fmtrewrites tag syntax into the block syntax in this PR (Preserve JSX tag syntax in autofmt #5731 makes it preserve tags). The only autofmt change here is glue: theBodyDelimitersthat fix(autofmt): stop dropping comments on attributes, spreads, control flow and empty macros #5883 introduced are built from aNodeDelimiter, mapping the tag tokens onto the open/close positions, so comments before/after tags, on attributes, and before closing tags survive the rewrite.Tests: parser unit tests in
jsx.rs(elements, components, generics, web components, spreads, shorthand, mixing, incomplete tags, unquoted text, error cases, codegen), SSR rendering tests inpackages/ssr/tests/jsx_syntax.rs, a hot-reload test, and an autofmt test for comment preservation (tests/wrong/jsx-comments*).Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/99eedb36d44345dc8ce0f3ed5c460bd6
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/99eedb36d44345dc8ce0f3ed5c460bd6?variant=devin-insiders
Requested by: @nicoburns