microsoft / vscode

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

[html] Unexpected "Declaration or statement expected" in HTML code #135849

Open oliversalzburg opened 2 years ago

oliversalzburg commented 2 years ago

Issue Type: Bug

This code will cause VS Code to raise 3 JS problems

<!DOCTYPE html><html><body><script>//%SCRIPT%</script><script>(function() {
}());</script></body></html>

Changing the code slightly, resolves the problems

<!DOCTYPE html><html><body><script>//%SCRIPT%</script>
<script>(function() {
}());</script></body></html>

To me, this is unexpected.

VS Code version: Code 1.61.2 (6cba118ac49a1b88332f312a8f67186f7f3c1643, 2021-10-19T14:57:20.575Z) OS version: Windows_NT x64 10.0.19043 Restricted Mode: No Remote OS version: Linux x64 5.10.16.3-microsoft-standard-WSL2 Remote OS version: Linux x64 5.10.16.3-microsoft-standard-WSL2

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-6850K CPU @ 3.60GHz (12 x 3592)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|79.87GB (42.74GB free)| |Process Argv|--folder-uri=vscode-remote://wsl+Ubuntu/home/oliver/fairmanager/fairmanager/core-web3 --remote=wsl+Ubuntu --crash-reporter-id 05565d81-cfc4-40de-88df-1c479bbe1bcd| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 5.10.16.3-microsoft-standard-WSL2| |CPUs|Intel(R) Core(TM) i7-6850K CPU @ 3.60GHz (12 x 3591)| |Memory (System)|62.71GB (50.55GB free)| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 5.10.16.3-microsoft-standard-WSL2| |CPUs|Intel(R) Core(TM) i7-6850K CPU @ 3.60GHz (12 x 3591)| |Memory (System)|62.71GB (50.55GB free)| |VM|0%|
Extensions (38) Extension|Author (truncated)|Version ---|---|--- tsl-problem-matcher|amo|0.5.0 javascript-ejs-support|Dig|1.3.1 eslint-disable-snippets|drK|1.3.0 output-colorizer|IBM|0.1.2 jupyter-keymap|ms-|1.0.0 remote-containers|ms-|0.202.5 remote-ssh|ms-|0.65.8 remote-ssh-edit|ms-|0.65.8 remote-wsl|ms-|0.58.3 vscode-remote-extensionpack|ms-|0.21.0 vscode-icons|vsc|11.6.0 vscode-zipfs|arc|2.3.0 better-toml|bun|0.3.2 vscode-eslint|dba|2.2.2 xml|Dot|2.5.1 EditorConfig|Edi|0.16.4 prettier-vscode|esb|9.0.0 generateuuid|Fir|0.0.5 shell-format|fox|7.1.1 vscode-graphql|Gra|0.3.18 yarn2-dependency-explorer|hah|0.0.1 terraform|has|2.16.0 vscode-esformatter|how|1.6.0 vscode-random|jre|1.10.0 template-string-converter|meg|0.5.3 code-beautifier|mic|2.3.3 vscode-docker|ms-|1.17.0 vscode-kubernetes-tools|ms-|1.3.3 python|ms-|2021.10.1365161279 vscode-pylance|ms-|2021.10.2 jupyter|ms-|2021.9.1101343141 jupyter-keymap|ms-|1.0.0 jupyter-renderers|ms-|1.0.3 test-adapter-converter|ms-|0.1.4 vscode-js-profile-flame|ms-|0.0.21 vscode-paste-image|mus|1.0.4 monolit|Oli|0.0.33 vscode-yaml|red|1.0.0 (1 theme extensions excluded)
aeschli commented 2 years ago

What's special is that all is on one line. The comment from the first script tag impacts the second one. It's a bug in out code.