microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.62k stars 29.42k forks source link

[html] False error of inline Javascript in HTML #233806

Open Wst-04d12 opened 1 week ago

Wst-04d12 commented 1 week ago

Does this issue occur when all extensions are disabled?: Yes

Version: 1.95.2 (user setup) Commit: e8653663e8840adaf45af01eab5c627a5af81807 Date: 2024-11-07T11:07:22.054Z Electron: 32.2.1 ElectronBuildId: 10427718 Chromium: 128.0.6613.186 Node.js: 20.18.0 V8: 12.8.374.38-electron.0 OS: Windows_NT x64 10.0.26100

Steps to Reproduce: Image

  1. you will get a false error ')' expected. from a working code with a regex starting with <!--.
    <script>
    let a = "abcdefg";
    a = a.replace(/<!--/g, "");
    </script> 

Depending on where and how you use these regex, the false error could be ')' expected., Expression expected., and Argument expression expected.. And I believe there are likely to be more of them.

RedCMD commented 1 week ago

invalid angle brackets are frowned upon you must escape them &lt; < , &gt; >