sveltejs / language-tools

The Svelte Language Server, and official extensions which use it
MIT License
1.25k stars 198 forks source link

Autocomplete {#snippet _} when within a Component #2499

Open pauldemarco opened 1 month ago

pauldemarco commented 1 month ago

Description

Here is a Component Header that takes a snippet title as a prop:

// Header.svelte
let {title}: {title: Snippet} = $props();

It is used like:

<Header>
    {#snippet title()}
        ...
    {/snippet}
</Header>

Proposed solution

It would be nice if the {#snippet _} could autocomplete for all snippets that the Component takes:

<Header>
    {#snippet <Autocomplete shows all my snippet options>}
        ...
    {/snippet}
</Header>

Alternatives

No response

Additional Information, eg. Screenshots

No response

jasonlyu123 commented 1 month ago

There is autocomplete already but with a big caveat, it doesn't work when the name is empty because of https://github.com/sveltejs/language-tools/issues/1302#issuecomment-1002358234.