Files
vscode/extensions/html-language-features/server
6dc67ef483 fix: wrap module script content in block scope to prevent false redeclaration errors (#308027)
* fix: wrap module script content in block scope to isolate variables (#229357)

When multiple <script> tags exist in an HTML file, the HTML language
server concatenates their content into a single virtual JavaScript
document for validation. This causes false "Cannot redeclare
block-scoped variable" errors when <script type="module"> tags declare
variables with the same name as regular <script> tags, since module
scripts should have their own scope per the HTML spec.

Fix by wrapping <script type="module"> content in block scope delimiters
({ ... }) in the virtual document, preventing variable name collisions
between module scripts and regular scripts.

* fix: validate HTML module scripts separately

* test: cover HTML module script isolation

---------

Co-authored-by: Martin Aeschlimann <martinae@microsoft.com>
Co-authored-by: Dmitriy Vasyura <dmitriv@microsoft.com>
2026-08-01 00:30:58 +00:00
..