tomblachut / svelte-intellij

Svelte components in WebStorm and friends

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Unexpected token" error when using a keyed each loop with an index and whitespace

dennisjlee opened this issue · comments

I discovered an edge case where the Svelte intellij plugin sees a syntax error for a line that is valid Svelte. To trigger the issue, I used an each loop while binding both the loop variable and an index variable, and also added a key clause, like this.

{#each things as thing, index (thing.id) }

Here's a REPL showing the code.
https://svelte.dev/repl/9e7975b7aad741d98d0a620247005332?version=3.46.4

The Svelte IntelliJ plugin highlights the closing } as an unexpected token.
image

Looks like space between ) & } is unsupported.
Thanks for reporting!

Migrated to WEB-61824 Svelte: fix parser issues