Open danon opened 3 years ago
Actually, even code like this causes parse error:
<div>
{`<test>`}
</div>
@Danon Hi, Could you share the exact file/ screenshot with the issue?
Sure, I'm using 1.0.3-SNAPSHOT
.
Here's the parse error: JSX tag, newline, and attribute with a template tag that holds <
character.
If I remove the new line, or I remove the <
character, or I replace template string with a regular "
or '
quote string, everything works ok.
But In my case I need both the new line, and <
and the template string.
Thank you!
Moving />
to the next line fixes the issue as well.
Original issue:
<CodeTabs
tregx={``}
php={`<`}/>
Of course, `first()` callback will asd qwe
:::note
WebStorm 2021.1 Beta
Build #WS-211.6305.4, built on March 2, 2021
сс: @anstarovoyt
@vladsholokhov Yea, but using <>
in the string still breaks it, even with the enter.
<CodeTabs
tregx={`<>`}
php={`<`}
/>
@vladsholokhov Do you think we can start some progress here?
@vladsholokhov Can you point me in the right direction, so maybe I can fix the bug myself? @@anstarovoyt
@Danon Hi! I've published the "1.2.211" version with the fix, please give it a try.
Unfortunately, the problem is rather general, so if you see something similar please let us know.
yes, it must be compatible with any IJ-based 2021.1 versions (PhpStorm, WebStorm, IJ IDEA, RubyMine, and so on)
@anstarovoyt The update didn't fix it all. For example this code, still breaks it
<CodeTabs
tregx="<c"/>
Interestingly, if you remove the enter, it doesn't break.
<CodeTabs tregx="<c"/>
@anstarovoyt Remember that the attributes must work for all kinds of strings, so:
<CodeTabs
tregx="<c"/>
<CodeTabs
tregx={"<c"}/>
<CodeTabs
tregx={'<c'}/>
<CodeTabs
tregx={`<c`}/>
@Danon could you please share the full code snippet, because I cannot reproduce with problem with 1.2.211
@anstarovoyt Sure: https://github.com/T-Regx/T-Regx.github.io/blob/source/docs/match-group.mdx This is a part of my documentation written in JSX. The parts in <CodeTabs
are a part of code samples.
the problem is different there (as I said before it is rather general). This sample doesn't work because of the multi-line attribute value and I am not sure that it can be easily handled in the current model.
@anstarovoyt So what can we do about it? Multiline attributes are valid in JSX.
Do you think you can show me shortly around, and maybe I could edit the plugin?
You can have regular tags inside regular strings or template strings:
but if you move the attribute to the next line, there is parse error