Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specific JavaScript syntax in HTML breaks highlighting #136293

Closed
jonaskohl opened this issue Nov 2, 2021 · 1 comment
Closed

Specific JavaScript syntax in HTML breaks highlighting #136293

jonaskohl opened this issue Nov 2, 2021 · 1 comment
Assignees

Comments

@jonaskohl
Copy link

jonaskohl commented Nov 2, 2021

Issue Type: Bug

When including JavaScript inside of a <script> tag inside of a HTML file, sometimes syntax highlighting breaks and the VSCode gets confused which language to use in the following lines. This also breaks the "Toggle Line Comment" feature. Below is a sample HTML you can paste inside of VSCode to reproduce:

<!DOCTYPE html>
<html>
    <head>
        <script>const version=[1,0,0]</script>
        <meta charset="utf-8">
        <title>Test</title>
    </head>
    <body>
        <p>Try "Toggle Line Comment" on this line!</p>
    </body>
</html>

When I close the JavaScript with a semicolon however, things behave as expected:

 <!DOCTYPE html>
 <html>
     <head>
-         <script>const version=[1,0,0]</script>
+         <script>const version=[1,0,0];</script>
         <meta charset="utf-8">
         <title>Test</title>
     </head>
     <body>
         <p>Try "Toggle Line Comment" on this line!</p>
     </body>
 </html>

VS Code version: Code 1.61.2 (6cba118, 2021-10-19T14:57:20.575Z)
OS version: Windows_NT x64 10.0.19043
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (8 x 1992)
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) 15.85GB (5.64GB free)
Process Argv --disable-extensions --crash-reporter-id f90958e1-7344-449a-b701-eeb06b6f31bb
Screen Reader no
VM 0%
Extensions disabled
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
vsccppwtct:30382698
bridge0708:30335490
pygetstartedt3:30385195
dockerwalkthru:30377721
bridge0723:30353136
pythonrunftest32:30373476
pythonf5test824:30373475
javagetstartedt:30391933
pythonvspyt187:30373474
vsqsis400:30386382
vsaa593cf:30376535
vssld246cf:30386378

@aeschli
Copy link
Contributor

aeschli commented Nov 2, 2021

duplicate of #70614

@aeschli aeschli closed this as completed Nov 2, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Dec 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants