Skip to content
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

fix: Fix support for Svelte 5 snippet blocks #73

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

SkylerLipthay
Copy link
Contributor

Improves upon #68. I was happy to see that PR, but markup_fmt v0.15.1 still had problems with parsing Svelte 5 snippet blocks when used in combination with typescript 0.93.1:

Unexpected token `/`. Expected identifier, string literal, numeric literal or [ for the computed key at file:///...MyComponent.svelte#.tsx:352:10

        <>{/snippet}</>

I didn't investigate the problem carefully, but I think this has something to do with the fact that the parser was treating the closing {/snippet} tag as text instead of consuming it and re-emitting it in the printer. Maybe this was intentional, since copying the above {/key} parsing logic was the obvious move I did. Perhaps @bartlomieju could comment.

This PR also fixes a typo (ExpectSvelteIfBlock -> ExpectSvelteSnippetBlock) that improves error reporting.

@bartlomieju
Copy link
Contributor

Perhaps @bartlomieju could comment.

I guess it wasn't intentional and that's a good catch.

Copy link
Owner

@g-plane g-plane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@g-plane g-plane merged commit d25b42b into g-plane:main Nov 5, 2024
2 checks passed
@bartlomieju bartlomieju mentioned this pull request Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants