sveltejs / sveltejs/language-tools

Each blocks without `as` clause highlight incorrectly

Open
#2,829 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.4k
Forks
252
Avg merge
8d 13h
Merged PRs (30d)
2

Description

Describe the bug

It's now possible to omit the as blah clause from an each block, but it results in incorrect highlighting

Image
Reproduction
{#each x as _}-{/each}
{#each x as}-{/each}
Expected behaviour

The syntax highlighting should be the same in both cases (I guess it's noteworthy that GitHub syntax highlighting exhibits the same bug)

System Info

latest

Which package is the issue about?

No response

Additional Information, eg. Screenshots

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the highlighting difference with the two Svelte snippets in the issue. Trace the syntax-highlighting handling for each blocks, then verify that {#each x as _}-{/each} and {#each x as}-{/each} receive the same highlighting when the fix is complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.