Skip to content

fix: extract style/script tag followed by destructuring in the template#2921

Merged
dummdidumm merged 11 commits intosveltejs:masterfrom
jasonlyu123:simple--parse
Feb 17, 2026
Merged

fix: extract style/script tag followed by destructuring in the template#2921
dummdidumm merged 11 commits intosveltejs:masterfrom
jasonlyu123:simple--parse

Conversation

@jasonlyu123
Copy link
Member

@jasonlyu123 jasonlyu123 commented Jan 19, 2026

#2854 #2155

This builds upon the original logic of #2914. Replacing the isInsideMoustacheTag logic with a simple bracket match with a simplified string check. Using the Svelte compiler in this preprocessor isn't really viable because even the loose parse mode still throws a syntax error with an expression while editing.

This also rewrites the parseHTML to use a custom parse logic instead of preprocess. Previously, we scanned the HTML to remove problematic "<" and ">". Now, it does one scan/parse. This should improve performance and might reduce memory usage since V8 won't store the preprocessed string in memory for the sliced string. The parse code is derived from vscode-html-languageservice, andthe main difference is

  1. Parse expression tag in Whitespace state
  2. parse attribute with interpolation in AttributeValue state
  3. Detect Svelte blocks/tags in Content state

@abdel-17 Are there other problems you encountered like this?

@paoloricciuti, since you also commented #2914, could you check if there are other situations that aren't covered by this? This function is used to blank < and > in HTML that confuses the vscode-html-languageservice's HTML parser.

@changeset-bot
Copy link

changeset-bot bot commented Jan 19, 2026

🦋 Changeset detected

Latest commit: 97908d5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte-language-server Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@abdel-17
Copy link

none that I can reproduce no

@jasonlyu123 jasonlyu123 marked this pull request as draft January 23, 2026 02:56
@abdel-17
Copy link

Hey I just wanted to say I really appreciate you working on this issue. Looking forward to seeing it fixed. :)

@jasonlyu123 jasonlyu123 marked this pull request as ready for review January 29, 2026 08:49
Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@dummdidumm dummdidumm merged commit c82f540 into sveltejs:master Feb 17, 2026
3 checks passed
@github-actions github-actions bot mentioned this pull request Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants