sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
76.98k stars 4k forks source link

Can we have an optional but checked name on the end-snippet tag? #11588

Open thebjorn opened 2 weeks ago

thebjorn commented 2 weeks ago

Describe the problem

Snippets can quickly become longer than a screenful and snippets can be deeply nested. It can be cumbersome to discover which starting tag belongs to the closing tag you're looking at.

Describe the proposed solution

Would it be possible to add a name to the closing tag, i.e.:

{#snippet header_slot()}
...
{/snippet header_slot}

the name should be optional, but if it is present the compiler should give an error if it doesn't match (or the nesting doesn't match) the name in the starting tag.

Importance

would make my life easier