language-tools
language-tools copied to clipboard
VSCode extension/intellisense slow in .svelte files with a lot of HTML
Describe the bug
VSCode's intellisense is slow when writing in .svelte files with significant HTML portions (>2500 lines). Waiting for it to suggest variables/properties can take many seconds, and pressing Ctrl+Space will show a "Loading..." indicator as the extension/VSCode attempts to report the available values.
However, commenting out the HTML portion of the .svelte files makes intellisense almost instant again. Even if that HTML code is replaced with equivalent amounts of JS code, intellisense continues to be fine, so it seems to be an issue with how the extension handles the HTML code.
In addition, the slowness happens even when the HTML code is completely basic - just a simple repeating div + span + input for 2500 lines with no svelte-specific bindings (on:click, bind:value, etc) to
Reproduction
I was able to recreate this just by putting together some random functions/variables and some HTML that bind to them.
Note that it's attached here as "testComponent.txt" since GitHub doesn't allow .svelte extensions, so it should be renamed back. In the file, I generated a bunch of random functions and values, and then appended a bunch of basic HTML underneath. There's a section of commented out functions extraF0 ... extraF999 which I use during the reproduction steps to demonstrate that extra JS code is handled without problems, it's just HTML code that slows down the IDE's intellisense.
- Open the attached file in VSCode with the Svelte for VS Code extension enabled
- Anywhere in the script tag, type something to see intellisense completion, e.g.
val0. - Observe that it takes multiple seconds for the suggestion list to appear, including the one for "a: (property) number".
- Comment out the HTML code and retry step 2
- Observe that intellisense now shows suggestions instantly
- Un-comment the lines of code with "extraFn" definitions (twice as long as the commented-out HTML).
- Repeat step 2
- Observe that intellisense continues to show suggestions immediately, despite there being even more code to parse through. testComponent.txt
Expected behaviour
Intellisense should suggest relevant variables/properties quickly.
System Info
- OS:macOS 13.5.2 - Apple Silicon (M1 Pro)-
- IDE: VSCode Version: 1.83.1 with svelte extension enabled
- Project created + configured (tsconfig/jsconfig) with SvelteKit
Which package is the issue about?
Svelte for VS Code extension
Additional Information, eg. Screenshots
No response