-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(javscript/typescript) improve JSX comment highlighting #1625
Comments
I'm pretty sure this is illegal JSX syntax, the spec doesn't mention using Edit: Apparently it is legal but only between |
So in that case it acts like a Javascript style comment... that probably also pours a little rainstorm on the idea of trying to use "html/xml" as the internal parser for these blocks though. Seeming more and more like we need a dedicated jsx grammar. |
There is a weirdness here though... we're inside "tag" (which has it's own styling) and when we hit a Any thoughts on this or naming? |
Some dark magic: contains: [
HTML_TAG,
XML_ENTITIES,
{
begin: /[^<]+/, // eat everything up until the next <
end: /./, // to avoid 0-width match error
// always return, this rule is not intended to consume
// anything, just bookend the JSX/HTML segment
returnEnd: true,
returnBegin: true,
endsParent:true, // when we've paired all HTML tags, we endParent
"on:begin": (_, resp) => {
if (nestedTagCount !== 0) resp.ignoreMatch();
}
}
] It's likely we just need a |
What about |
Live example on the npm website.
Expected behavior
Comments in jsx attribute positions should look like comments. The spec isn't explicit about it, but babel, acorn, typescript, and flow all support the syntax.
Thanks!
original issue
The text was updated successfully, but these errors were encountered: