sveltejs / language-tools

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

Destructuring inline event parameters breaks IntelliSense #2155

Open ignatiusmb opened 1 year ago

ignatiusmb commented 1 year ago

Describe the bug

Having an inline event handler inside an element (doesn't have to be a special element) breaks <style> tag IntelliSense.

Reproduction

Copy and paste the snippet to an empty .svelte file and trigger the autocomplete box in the styles tag

<svelte:window
    on:mousemove={({}) => {
        // destructuring the parameter above breaks autocompletion
        // remove the empty brackets and the css autocompletion below works
    }}
/>

<div><slot /></div>

<style>
    div {
        /* trigger autocomplete here, gets JS variables instead of CSS */
    }
</style>

Expected behaviour

CSS autocompletion works without having to move destructuring inside the function body.

System Info

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

No response

ShadiestGoat commented 1 month ago

Its not just for destructuring (though I can replicate that as well). In this snippet, it breaks with the same symptoms:

<svelte:window
    on:mousemove={() => {
        if (true) {return}
        if (2 >= 1) {}
    }}
/>

<style lang="scss">
    /* js suggestions here :// */
</style>