-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Svelte 5: Incorrect IfBlock Start Position in Modern Mode Parsing #11975
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
Comments
I wonder if we should just make |
Hi Rich, Thank you for your response. I agree that making By the way, I am the developer of Markuplint, which utilizes the Svelte parser. Whether it outputs accurate location data or parsing errors, I will follow the Svelte compiler's approach. |
I remember some people writing it like that for some reason (someone opened an issue in language tools about this syntax not working a while back). |
I'm actually more concerned about consistency within the ecosystem |
Found the related issue: sveltejs/language-tools#1638 seems like a very small group of people prefer writing code like this? Anyway I'd be ok with disallowing it. |
disallow characters between `{` and `#` / `:` / `@` in runes mode closes #11975
disallow characters between `{` and `#` / `:` / `@` in runes mode closes #11975
Describe the bug
While experimenting with Svelte v5.0.0-next, I encountered a bug in the
svelte/compiler
parse
function when parsing in modern mode. The issue arises with theIfBlock
start position when there is a space between{
and#if
.Code Example:
Parsed Output:
In this example, the
start
position of theIfBlock
is incorrectly set to4
. It should be0
(the position of{
).Expected Behavior:
The
start
position should be0
if there is a space between{
and#if
. If a space is considered a syntax error, an exception should be thrown indicating a parse error.Additional Context:
When there is no space between
{
and#if
, thestart
position is correctly set to0
:Parsed Output:
This behavior suggests that the space handling between
{
and#if
might not be correctly implemented.Additional Information:
If the space between
{
and#if
is syntactically incorrect, an exception indicating a parse error should be thrown instead of silently misplacing the start position.Reproduction
Environment:
Steps to Reproduce:
svelte/compiler
parse
function in modern mode.start
position of theIfBlock
in the parsed output.Reproduction Code: https://jqctdp.csb.app/
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: