microsoft / pylance-release

Documentation and issues for Pylance
Creative Commons Attribution 4.0 International
1.69k stars 769 forks source link

python code are not rendered in correct colors in "Visual Studio Dark" and "Default Dark Modern" theme #6114

Open goldenbull opened 1 month ago

goldenbull commented 1 month ago

Type: Bug

how to reproduce

When using the theme Visual Studio Dark, python codes are not well colored, but the raw string is displayed correctly.

When switched to the theme Default Dark Modern, more colors are shown for python code, but the escaping backslash \ in raw string is not displayed correctly.

vscode-bug

system info

Extension version: 2024.10.0 VS Code version: Code 1.91.0 (ea1445cc7016315d0f5728f8e8b12a45dc0a7286, 2024-07-01T18:52:22.949Z) OS version: Windows_NT x64 10.0.20348 Modes:

User Settings

``` languageServer: "Pylance" ```

Installed Extensions |Extension Name|Extension Id|Version| |---|---|---| |Black Formatter|ms-python.black-formatter|2024.2.0| |DolphinDB|dolphindb.dolphindb-vscode|3.0.100| |JavaScript Debugger|ms-vscode.js-debug|1.91.0| |JavaScript Debugger Companion Extension|ms-vscode.js-debug-companion|1.1.2| |Markdown All in One|yzhang.markdown-all-in-one|3.6.2| |Markdown PDF|yzane.markdown-pdf|1.5.0| |Pylance|ms-python.vscode-pylance|2024.7.1| |Python|ms-python.python|2024.10.0| |Python Debugger|ms-python.debugpy|2024.6.0| |Remote - SSH|ms-vscode-remote.remote-ssh|0.112.0| |Remote - SSH: Editing Configuration Files|ms-vscode-remote.remote-ssh-edit|0.86.0| |Remote Explorer|ms-vscode.remote-explorer|0.4.3| |Table Visualizer for JavaScript Profiles|ms-vscode.vscode-js-profile-table|1.0.9| |Vue - Official|Vue.volar|2.0.8|
System Info |Item|Value| |---|---| |CPUs|Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz (16 x 2200)| |GPU Status|2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: unavailable_software| |Load (avg)|undefined| |Memory (System)|32.00GB (2.92GB free)| |Process Argv|--crash-reporter-id a361c834-537f-4f56-92bb-b55095492d3d| |Screen Reader|yes| |VM|100%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 2i9eh265:30646982 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 jchc7451:31067544 chatpanelc:31048052 dsvsc021:30996838 9c06g630:31013171 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupyter:31046869 newcmakeconfigv2:31071590 legacy_priority:31082724 ```
debonte commented 1 month ago

This is a bug in our TextMate grammar (https://github.com/MagicStack/MagicPython). There's some discussion about possible approaches to fixing all of our issues of this type in https://github.com/microsoft/pylance-release/issues/5824. That issue also includes a list of isses that have been filed against MagicPython on escape sequences in raw strings, so it's a known pain point. We haven't decided how to address this class of issue yet.