microsoft/vscode

Syntax Highlighting Error

Wang-Yile opened this issue · 5 comments

Type: Bug

When I wrote a HTML text in VS Code with Python extension,
I found this line:

<span class="comment"># Python 3</span>

has some problems in highlighting syntax.

It expects red because it is in a read-only string.
But, in fact, it is green.
That means the extension thinks it is notes.

I am using Python 3.11.2 (64-bits)

This my code:

_html = r"""
        <!DOCTYPE html>
        <html>
            <head><meta charset="utf-8"></head>
            <body>
                    <span class="comment"># Python 3</span>
            </body>
        </html>
"""

You should copy it into VS Code to see its effect.

Extension version: 2023.7.10901017
VS Code version: Code 1.77.0 (7f329fe, 2023-03-29T10:02:16.981Z)
OS version: Windows_NT x64 10.0.22621
Modes:
Sandboxed: Yes

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i5-12400F (12 x 2496)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) undefined
Memory (System) 15.79GB (3.91GB free)
Process Argv --crash-reporter-id fc004f5b-7ef2-45d0-a18a-09e9d61149a2
Screen Reader no
VM 50%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vstes627:30244334
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
vscccc:30610679
nodejswelcome1cf:30587006
2e4cg342:30602488
pyind779:30671433
f6dab269:30613381
pythonsymbol12:30671437
vsctsb:30677850
functionswalk:30687959
pythonms35:30701012

@Wang-Yile Can you provide a screen shot of the issue?

@karthiknadig it should be text mate who is doing this. do you know which repo we need to transfer this issue to?

@heejaechang It should be VS Code core repo. I will transfer.

We get our Python syntax highlighting grammar from https://github.com/MagicStack/MagicPython. I've opened MagicStack/MagicPython#257 for this issue.