tomblachut / svelte-intellij

Svelte components in WebStorm and friends
MIT License
482 stars 38 forks source link

Wrongly supporting #each with index as first parameter #283

Closed avi12 closed 1 year ago

avi12 commented 2 years ago

In my code I had something like:

<script>
  const obj = {
    key: "foo"
  };
</script>

{#each obj as i, { key }}
  {key}
{/each}

I learned the hard way that the i should come after the { key }, not before it, i.e.

{#each obj as { key }, i}
  {key}
{/each}

The plugin did not report anything wrong, which resulted in Prettier failing and I wasn't sure why. Took me a while to figure that one out Plugin version: 0.21.2

tomblachut commented 1 year ago

Handled by the language server, kind of, WEB-58397 use the svelte language server