feat: support render tags, attachments, declaration tags, and snippet declarations #49

Merged
corneliusio merged 1 commit from feat/svelte5-template-tags into feat/ts-template-expressions 2026-08-21 16:14:14 +00:00
corneliusio commented 2026-08-15 07:22:20 +00:00 (Migrated from github.com)

Adds highlighting for the remaining modern Svelte 5 template syntax (stacked on #48 for TypeScript-aware expression parsing):

  • {@render ...} is recognized as a special tag; the call expression after it parses normally, including optional chaining.
  • {@attach ...} works in attribute position on elements and components, where brace attributes enter the interpolation path that previously bypassed special-tag handling.
  • {let ...} / {const ...} declaration tags (Svelte 5.56) parse as real declarations: keyword, binding patterns (destructuring, TS annotations), and initializers. {@const ...} now shares the same binding contexts, improving destructuring.
  • {#snippet name(params)} scopes the snippet name as entity.name.function.svelte and parses parameters as function parameters, including TS annotations, defaults, and generic type parameter lists ({#snippet pair<T>(a: T, b: T)}).

Addresses findings 2, 3, and 5 of the syntax audit. Includes review fixes from gpt-5.6: dollar-prefixed snippet names ({#snippet $row(...)}) and generic snippet signatures, both verified valid against the Svelte compiler.

All referenced default-package contexts exist in ST 4143 through latest; tests pass on both.

Adds highlighting for the remaining modern Svelte 5 template syntax (stacked on #48 for TypeScript-aware expression parsing): - `{@render ...}` is recognized as a special tag; the call expression after it parses normally, including optional chaining. - `{@attach ...}` works in attribute position on elements and components, where brace attributes enter the interpolation path that previously bypassed special-tag handling. - `{let ...}` / `{const ...}` declaration tags (Svelte 5.56) parse as real declarations: keyword, binding patterns (destructuring, TS annotations), and initializers. `{@const ...}` now shares the same binding contexts, improving destructuring. - `{#snippet name(params)}` scopes the snippet name as `entity.name.function.svelte` and parses parameters as function parameters, including TS annotations, defaults, and generic type parameter lists (`{#snippet pair<T>(a: T, b: T)}`). Addresses findings 2, 3, and 5 of the syntax audit. Includes review fixes from gpt-5.6: dollar-prefixed snippet names (`{#snippet $row(...)}`) and generic snippet signatures, both verified valid against the Svelte compiler. All referenced default-package contexts exist in ST 4143 through latest; tests pass on both.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
repos/svelte-sublime!49
No description provided.