-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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: correctly parse each
with loose parser
#14887
Conversation
🦋 Changeset detectedLatest commit: ee00946 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Does this also fix sveltejs/language-tools#2636? I haven't figured out if it's a compiler or a svelte2tsx issue. For some odd reason, I can only see it in some projects. But the problem is the |
I suspect yes...you probably can only see it for projects that uses svelte version after the loose parser |
The weird thing is that I can't reproduce it in the svelte test or the svelte2tsx test and all the version is 5.16.0. But it does seem to be fixed if I install the pkg.new version in the project where I can reproduce the problem. Hopely it is really fixed and not just another situation where it doesn't show up 😅 |
Yeah I think we need to add a test suite for the loose parser: |
Closes #14766
This was a wild chase: initially i thought it was a problem with the
language-tools
but then i realised that theast
foreach
was incorrectly generated when inloose
mode...the reason is because in theeach
we are relying onacorn
throwing the error onparse_expression
to then backtrack for situations likeas { x = y }
...the loose parser made this impossible and returned an incorrect identifier which in turn was screwing the language server.This fixes it even tho I'm not a huge fun of the solution because it means we need to handle the error differently if we are in an each but i don't think there's another way.
I've added a test only in
parser-modern
...should i add one in legacy too?Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.packages/svelte/src
, add a changeset (npx changeset
).Tests and linting
pnpm test
and lint the project withpnpm lint